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.
Author |
Topic |
imranabdulaziz
Yak Posting Veteran
83 Posts |
Posted - 2010-08-12 : 05:24:53
|
Hi All,I am using Sql server 2005.My table is likeEmpcode Date em001 2,3,7 em002 12 , 5 I need to break it asempcode dateem001 2em001 3em001 7em002 12em002 5Is there any other way apart from cursor to do the jobPlease help |
|
Sachin.Nand
2937 Posts |
Posted - 2010-08-12 : 05:29:05
|
Is your table & data is really that way or is it just some sample data???You save dates in comma seperated format?Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless. PBUH |
 |
|
imranabdulaziz
Yak Posting Veteran
83 Posts |
Posted - 2010-08-12 : 05:37:02
|
No It is a temp table where data comes from excel |
 |
|
Bustaz Kool
Master Smack Fu Yak Hacker
1834 Posts |
Posted - 2010-08-12 : 13:07:47
|
In broad strokes:1) Write a table valued function that accepts a CSV string and returns the individual strings between the commas. There are samples of this available via a search.2) Perform a CROSS APPLY of your table data and the function you just developedselect Empcode, MyValuefrom EmployeeCROSS JOINMyCSVFunction(Date) -- Returns a column named "MyValue"HTH=======================================A couple of months in the laboratory can save a couple of hours in the library. -Frank H. Westheimer, chemistry professor (1912-2007) |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
|
|