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
 SQL Split

Author  Topic 

chechu
Starting Member

9 Posts

Posted - 2011-06-02 : 10:38:11
Hi there,

I need to create a script in order to split the data located in a column into two separated columns, performing an insert into. Let me show u an example:

I have this string in a column, named FullName: [server].bd_Catalog
And i want to split that into two separated strings and insert them into 2 new columns named: ServerName:[server] and CatalogName:Bd_Catalog

So the Delimiter will be the "." between [server] and Bd_Catalog

I've been googling a bit but I couldn't find any clear enough example of picking data and then performing an insert into until all colums have been splited.

Any ideas?

Thanks in advance.

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2011-06-02 : 10:40:39
select parsename( '[server].bd_Catalog',1)
select parsename( '[server].bd_Catalog',2)


Jim

Everyday I learn something that somebody else already knew
Go to Top of Page
   

- Advertisement -