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 |
SunnyDee
Yak Posting Veteran
79 Posts |
Posted - 2015-04-30 : 16:52:26
|
Hello All,I have values in a field that looks similar to the values below:'testa', 'testb', 'testc', 'testd'How can I break this out in a query so that testa is returned in column1, testb is returned in column2, testc is returned in column3? I have tried using a combination of charindex('''',test_desc) and substring, but I cannot get past the first value.Thanks for any help! |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2015-04-30 : 19:09:46
|
I don't understand what you want. It seems your data already has it according to what you posted. Need a better "picture" to explain the issue.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
SunnyDee
Yak Posting Veteran
79 Posts |
Posted - 2015-05-01 : 10:12:27
|
SELECT COL1 FROM TABLE1 returns data like belowROW1 'testa', 'testb', 'testc', 'testd'ROW2 'test1', 'test2', 'test3'ROW3 'test15', 'test16', 'test17', 'test18' |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2015-05-01 : 12:25:19
|
But what does the data look like in the table?Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
Kristen
Test
22859 Posts |
Posted - 2015-05-02 : 03:31:56
|
Please post an example:CREATE TABLE #TEMP( COL1 varchar(100))INSERT INTO #TEMP (COL1)SELECT 'xxx' UNION ALLSELECT 'yyy' ... and then folk here can advise how to process/parse the data |
|
|
|
|
|
|
|