September 30, 2010 at 12:28 am
hi friend,
i have the following csv value sent from the client:
@csv nvarchar(max)
set @csv
=
1,'hello, how are you?',23.44,f,1,'sfsfsdfssfs'
2,'c, d and q are not',2.34,t,1,'sdfss'
3,'c, e and a are not',34.8,f,1,'sdfss'
4,'i, j and k are not',5.77,f,1,'sdfss'
Note that the valeu in @csv is a multi line and multi columned. How do i extract these values
and store in temp table or return as a table from table-valeu fucntion?
PS: im SQL learner so please, commment and explain the SQL statements that you write 🙂
thank you
September 30, 2010 at 1:02 am
Tel me, your client is giving all the data in a single variable ? i mean, all the rows combined into a variable ?
Some more Qs:
1. Will rows be separated by an "Enter" (or line-feed) inside the variable, always ?
2. Is the number of comma separated values consistent in the local variable for each row?
September 30, 2010 at 1:17 am
ColdCoffee (9/30/2010)
Tel me, your client is giving all the data in a single variable ? i mean, all the rows combined into a variable ?
Yes
Some more Qs:
1. Will rows be separated by an "Enter" (or line-feed) inside the variable, always ?
each line was seperated by a "new line charactor" or in C#
2. Is the number of comma separated values consistent in the local variable for each row?
Yes, as you can see in structure of the values in my original post : )
October 11, 2010 at 5:37 am
Please see the following to do what you need...
http://www.sqlservercentral.com/articles/T-SQL/63003/
The embedded comma that you have will cause a bit of frustration on your part but I'm sure you'll be able to work around that.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply