[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.sqlserver.programming

Sincronize values. Confusing

shapper

3/29/2007 5:51:00 PM

Hello,

I have two tables as follows:

[Labels] > LabelId (PK), LabelName

[LabelsInPosts] > LabelId (PK), PostId (PK)

I am trying to do the following:

1. Two parameters are given:
- LabelsList (NVARCHAR)
> LabelsList has the format: Label1,Label2,Label3,Label4

- PostId (UNIQUEIDENTIFIER)

2. Synchronize LabelsList with LabelsInPosts.
This means that for the given postId:

a) If a label from LabelsList is not associated with postId then
add it to LabelsInPosts.
Note: If the label do no exist in Labels table then it should
be added to it.

b) If a label from LabelsList is associated with the given postId
but it is not in LabelsList then it should be removed from
LabelsInPosts.
Note: If the removed label is not associated with any other
posts in LabelsInPosts then it should be removed from
Labels table.

Basically this is a synchronization.

Could someone, please, help me out?

I am completely lost in how to pull this out.

Thanks,
Miguel

1 Answer

Anith Sen

3/29/2007 6:47:00 PM

0

Please see www.aspfaq.com/5006 & post your table DDLs, sample data along
with the expected results.

--
Anith