Monday, February 20, 2012

Limit string lengh

There is a way to limit the length in characters returned by but I cant find what it is.

As an example, returning only the first 20 characters of a field.

Any help would be greatly appreciated.

You can either SUBSTRING or LEFT string functions in your case to get what you want. For example,

SELECTLEFT(yourcolumn, 20)AS col20_1,SUBSTRING(yourcolumn,1,20)as co20_2 FROM yourtable

You can find more string function from this link.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_fa-fz_7oqb.asp

Limno

|||Thank you!

No comments:

Post a Comment