May 16, 2006 at 10:44 am
hi,
I wanna get partial text data from a text field. say first 100 characters from it. So i can list the partial text in a grid.
Any ideas.
May 16, 2006 at 10:54 am
thanks
May 16, 2006 at 10:54 am
SELECT
LEFT(MyCol, 100) as LeftVal
SUBSTRING(MyCol, 1, 100) as SubStrVal
FROM MyTable
May 16, 2006 at 11:05 am
Note that if it genuinely is a column of type 'text' (as opposed to varchar), the left function will error. In that case, you can use cast instead.
declare @t table (TextColumn text, VarcharColumn varchar(800))
insert @t select 'fsdkjasdlkjfljsfdfklsjsfalasfjdfsda', 'fsdkjasdlkjfljsfdfklsjsfalasfjdfsda'
select cast(TextColumn as varchar(10)), left(VarcharColumn, 10) from @t
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
May 16, 2006 at 11:07 am
details, details...
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply