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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 *sigh*, I really tried to google it this time

Author  Topic 

ConradK
Posting Yak Master

140 Posts

Posted - 2009-11-18 : 10:52:36
**2nd edit**
hey, so I guess what I'm trying to say is that I have an 'array', like ape, banana, chocolate and would like to seperate this single column into multiple colums... does this make sense?

/edit

Okay, so another question. 3 in 24 hours. Not a good start to a forum I know...

anyways I need to pull data from one are and spread it amongst multiple rows

I have data that looks like this

Item Keywords
awsoem thing ape, banana, chocolate, dice
evem more cool apple, baboon, corn, dollars, fungus

etc..

and I need to spit out something like this

Item keyword1 keyword2 keyword 3
awsoem thing ape banana chocolate
evem more cool apple baboon corn


And I need to to take just three of those keywords from the original data, although some may have more, some may have less...

Best I can find is I need some kind of 'unpivot' deal? Again, I am extremely new to this stuff, and so reading language is hard for me. I'll try my best, and be happy knowing that google indexs' these things, and maybe someone can learn from my mistakes...

Thanks!

*edit* its cutting out my spaces... my show of the data table isn't showing up in the forum right.

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2009-11-18 : 11:17:20
It's not an unpivot -- though it is close.

Unpivoting is where you have multiple columns and you unpivot them into 1 column with many rows.

this is a string splitting deal. Why not just import the data as a comma separated file? you can use the dts wizard.

Which version of sql server do you have?


Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page

ConradK
Posting Yak Master

140 Posts

Posted - 2009-11-18 : 12:48:35
I have no idea even if we are using mysql or oracle or sqlserver or what. I don't know. I forwarded the problem to our dedicated IT guy. We can't write functions to the database to we are SOL there.

But your idea is ingenious. Just export as csv, and add extra columns manually and it'll read what i want how i want it. Brilliant really. But we need a way to spit out the feed, and be able to just shove it back in...

Thanks for your help guys
Go to Top of Page
   

- Advertisement -