Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

limit the length of a variable

Status
Not open for further replies.

junkmail

Programmer
Jan 7, 2001
134
US
The following code works fine as far as the logic goes but can someone tell me why the salesrep variable always displays the max length even though I am telling it to display only 22 characters?

case when substring(b.jobnumber,1,1) ='N' then (select left(salesrep,22) from db1..import_order_table where b.jobnumber=import_order_table.orderid) else (select left(description,22) from db2..salesrep where o.salesrepcode=salesrep.code) end as salesrep
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top