Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Column lenghts

Author  Topic 

GavinD1977
Yak Posting Veteran

83 Posts

Posted - 2006-08-08 : 05:16:26
Hello all. I have a column of type varchar(40). It is within a table i copy values to (obviously from another table). The problemi have is that sometimes the values copied over are greater than 40 characters. Is there anyway I can force the copied over value to insert the first 40 characters and just discard the ramaining ones?

Thanks people.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-08-08 : 05:18:04
use left(col, 40)


KH

Go to Top of Page

GavinD1977
Yak Posting Veteran

83 Posts

Posted - 2006-08-08 : 05:23:38
Brilliant stuff. Thanks khtan
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-08-08 : 13:30:12
or
substring(col,1,40)

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2006-08-08 : 16:56:10
or fix you columns

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam
Go to Top of Page
   

- Advertisement -