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 |
jfarr@floyd.org
Starting Member
3 Posts |
Posted - 2009-04-30 : 11:11:21
|
I have a database where the current setup has a unique row number, and then the item_id, omni_stid, and item_name can be duplicates. Ex.ROW item_id omni_stid item_name1 1002 FM4NRTH VALVE ANTI- REFLUX PREVENT2 1002 FM4SOUTH VALVE ANTI- REFLUX PREVENT3 1002 FMICU VALVE ANTI- REFLUX PREVENT4 1002 FMPAL VALVE ANTI- REFLUX PREVENTI need to create a new database where there is only one line for each Item_id, and then the omni_stid has each value seperated by a semicolon. Based on the sample data above, the line for item_id = 1002 should look like:ROW item_id omni_stid item_name1 1002 FM4NRTH;FM4SOUTH;FMICU;FMPAL VALVE ANTI- REFLUX PREVENTI do not have any idea on how to transition from the current table setup to the new. Thanks in advance for any help. |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
jfarr@floyd.org
Starting Member
3 Posts |
Posted - 2009-04-30 : 13:57:59
|
I did forget to include the reason for change in format. The data will remain in the original table in the correct format. The reason for creating the new table is at the request of our interface developer. He needs a table that only has one line for each item_id. This new table will only be used for his interface. |
 |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2009-04-30 : 14:15:41
|
Then write a stored procedure for the developer to use that formats the data the way he needs it. Don't create a new table to store the same data in a different format.And frankly, your developer should be able to create this CSV in his code, it's a lot easier there than in SQL. Sounds like he needs this as a source for a dropdown box. |
 |
|
jfarr@floyd.org
Starting Member
3 Posts |
Posted - 2009-04-30 : 14:25:21
|
I am relatively new to SQL and I voiced my concern for making the changes in a new table. Quite honestly, I do not even know where to begin to create a stored procedure for him to get the current data into the required format. |
 |
|
|
|
|