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.
| Author |
Topic |
|
baburk
Posting Yak Master
108 Posts |
Posted - 2008-11-19 : 01:41:38
|
| Hi,Here @Tags contains Babu, Saravanan. If 'Saravanan' is in the table insert only 'Babu'.From the below query how can I able to pass the value for the TagSET ItemId = 10SET @Tags = 'Babu,Saravanan'INSERT INTO (ItemId, Tag) dbo.ItemTags VALUES(@ItemId, ? )WHERE ','+@Tags+',' NOT LIKE '%,'+ItemTags.Tag+',%'Thanks. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-19 : 02:04:58
|
| [code]INSERT INTO dbo.ItemTags (ItemId, Tag)SELECT @ItemId, ValFROM dbo.ParseValues(@Tags,',') fLEFT JOIN dbo.ItemTags tON f.Val=t.TagWHERE t.Tag IS NULL[/code] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-19 : 02:06:01
|
| ParseValues can be found herehttp://www.sqlteam.com/forums/topic.asp?TOPIC_ID=113563 |
 |
|
|
baburk
Posting Yak Master
108 Posts |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-19 : 03:13:50
|
Welcome |
 |
|
|
|
|
|