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)
 UPDATE Problem

Author  Topic 

malo2006
Starting Member

2 Posts

Posted - 2010-10-14 : 10:14:56
Hi
i've a table like this:

BusinessID|DepID|PersID|skill1|skill2|skill3|skill4|isFirstSkill
1 4 76 skillA NULL NULL NULL X
1 4 76 skillT NULL NULL NULL NULL
1 4 76 skillC NULL NULL NULL NULL
1 4 76 skillR NULL NULL NULL NULL
1 4 31 skillQ NULL NULL NULL NULL
1 4 31 skillB NULL NULL NULL X
1 4 31 skillC NULL NULL NULL NULL
6 4 45 skillD NULL NULL NULL X
6 4 45 skillB NULL NULL NULL NULL
1 5 49 skillA NULL NULL NULL X
8 1 77 skillA NULL NULL NULL X
8 1 77 skillE NULL NULL NULL NULL

isFirstSkill defines the skill which has to be set to skill1

and it should look like this because the PersonID has to be a key:

BusinessID|DepID|PersID|skill1|skill2|skill3|skill4
1 4 76 skillA skillT skillC skillR
1 4 31 skillB skillQ skillC
6 4 45 skillD skillB
1 5 49 skillA
8 1 77 skillA skillE

Has anyone an idea

I tried solving the problem with a cursor but it takes hours.
There are about 180000 Persons in the table


malo2006

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2010-10-14 : 12:26:28
Do you have the option to fix your schema or are you already locked into that design?
Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2010-10-14 : 13:03:00
Oh man..
Who on the hell designed that table ?

PBUH

Go to Top of Page

malo2006
Starting Member

2 Posts

Posted - 2010-10-15 : 09:35:38
no there is no way to change the design.
I got the first table out of SAP and need to transfer it into our Database where the PersonID is the key

I thought that it might be possible to do that by joining the first table with itself on PersonID and the Skill1

but i've no idea what to do then

anyone an idea?????
Go to Top of Page
   

- Advertisement -