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
 How to get 20 text

Author  Topic 

thomson
Starting Member

9 Posts

Posted - 2009-08-04 : 12:22:10
I have a table and one colume is ntext type. How can I write a sp to get 20 characters by id from that table.

Thanks,

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2009-08-04 : 13:08:07
use substring. ie: for first 20 characters: SUBSTRING(col, 1, 20)

text and ntext have been replaced by varchar(max) and nvarchar(max). You should use those instead. If the largest expected value is less than 8000 (4000 for nvarchar)) characters then use nvarchar(<largestExpectedValue>)

Be One with the Optimizer
TG
Go to Top of Page

thomson
Starting Member

9 Posts

Posted - 2009-08-04 : 16:12:12
thanks a lot. TG
Go to Top of Page
   

- Advertisement -