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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Data query

Author  Topic 

starnold
Yak Posting Veteran

83 Posts

Posted - 2008-10-29 : 06:08:46
I have the below data in a table within SQL 2005:

ID System KEY Value
1 miv3demo Discoverer_CoreOptions Selection,Cube,Chart

What I would like to do is write a query to transform it so that it looks like:

ID System KEY Value
1 miv3demo Discoverer_CoreOptions Selection
1 miv3demo Discoverer_CoreOptions Cube
1 miv3demo Discoverer_CoreOptions Chart

Is there a way to do this?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-29 : 06:15:08
[code]SELECT t.ID, t.System, t.KEY, tmp.Val
FROM YourTable t
CROSS APPLY dbo.ParseValues(t.Value)tmp[/code]

ParseValues can be found here

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=111986
Go to Top of Page

starnold
Yak Posting Veteran

83 Posts

Posted - 2008-10-29 : 06:16:34
I have tried this before but it never works on SQL 2005 =(
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-29 : 06:24:09
it works if you've compatibility level set to 90
Go to Top of Page

starnold
Yak Posting Veteran

83 Posts

Posted - 2008-10-29 : 06:28:18
Is there a way to write the script to make the DB think it has its compatibility level set to 90 without having to actually change it?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-29 : 06:32:14
quote:
Originally posted by starnold

Is there a way to write the script to make the DB think it has its compatibility level set to 90 without having to actually change it?


nope. you have to change it before using this. you can use sp_dbcmptlevel system stored procedure to change compatibility level

http://msdn.microsoft.com/en-us/library/ms178653.aspx
Go to Top of Page
   

- Advertisement -