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
 Need help with Stored Procedure.

Author  Topic 

osirisa
Constraint Violating Yak Guru

289 Posts

Posted - 2009-08-10 : 16:08:55
Ok. I am going to make this explanation visual.
[code]Resp_Code|Conflicts
________A_______|_____B,D,C_____
________B______|______D,A______
________C______|______A__________
________D______|______A,B_________

________T_______|___C* Important,I want to add this conflict to Row C separate by a comma after the letter "A"./code]

Ok. I know it looks a little confuse. In the first case "A" is conflicting with "B", "D", "C" - So, you can see that B, D, C rows has A as part of their conflict. If I enter a new row for example row T conflict with Row C, I want to be able to add this conflict next to A separate it by a comma.

Also, If I delete, I want to be able to delete all the entries for that specific Resp_Code. Any help is welcome.

Thank you.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-08-11 : 00:09:21
like this ?

declare @Resp_Code char(1),
@Conflicts char(1)

select @Resp_Code = 'C',
@Conflicts = 'T'

update t
set Conflicts = Conflicts + ',' + @Conflicts
from yourtable t
where t.Resp_Code = @Resp_Code



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

osirisa
Constraint Violating Yak Guru

289 Posts

Posted - 2009-08-11 : 10:38:38
Thank you khtan, I'll give it a try. Thanks,
Go to Top of Page
   

- Advertisement -