Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 06, 2012 02:42 AM by Amy Peng - MSFT
Nov 05, 2012 05:56 AM|LINK
I hava o table in sql with TEXT datatype for column and data is 200+ lines text of document.
Now i want to select 1st line of that column.
How can i achieve that.
Thanks in advance.
Nov 05, 2012 08:22 AM|LINK
Check this link
Nov 05, 2012 08:26 AM|LINK
select top(1) * from tablename order by id asc
Nov 05, 2012 09:15 AM|LINK
I dont want to select top row
My requirement is like a column contains huge data like full document. in that i want to select first line from that column. and all rows..
Nov 05, 2012 09:33 AM|LINK
I don't know it's helpful to you or not but try this
declare @Name as nvarchar(200)
select top 1 @Name = YourDetails from tblemployeemaster
Here YourDetail is your nvarchar(max) field.
You take it in Variable named @Name which has length 200 character.
So you'll get 200 character only from nvarchar text.
Hope it's helpful to you.
Nov 05, 2012 09:47 AM|LINK
Hi I an so thankful for ur reply, I can achieve your trik by SubString(Ti, 1, 25) also.
But all I need is
SELECT id, name, [Document] FROM Book_table
This works fine but the [
Here i need to select first line of that....
Nov 05, 2012 10:07 AM|LINK
Use Text Function to get result.
I think TEXTPTR function will work for you.
Check msdn help
Nov 06, 2012 02:42 AM|LINK
The following thread is also about select the first line in the text field, please try to refer to: