I have two SQL tables:
User:
UserId(nvarchar)Tags(nvarchar)
Profile:
UserId(nvarchar)Tags(nvarchar)
Example:
User table:
UserId Tags
----------------------------------
1 tag1,tag2,tag3,tag4
2 tag1,tag2
3 tag1
4 tag2,tag3,tag4
after the Profile table tags should be
Profile table:
UserId Tags
-------------------------------------
1 ["tag1","tag2","tag3","tag4"]
2 ["tag1","tag2"]
3 ["tag1"]
4 ["tag2","tag3","tag4"]
Currently the user tags are stored in User table in the Tags column like this, separated by comma: tag1,tag2,tag3,tag4. There can be also one single tag listed: tag1 (no comma present).
I need to "move/copy" those tags in the Profile table Tags column in the following format (string array): ["tag1","tag2","tag3","tag4"]
So basically in my update statement bellow, second line: SET Profile.Tags = UA.TAGS, UA.TAGS value should be converted into an array of strings.
UPDATE Profile
SET Profile.Tags = UA.TAGS (UA.TAGS value should be an array)
FROM Profile UP INNER JOIN User UA ON UP.UserId = UA.UserId
Any ideas how I can achieve that?
Tagsfor the tags, and a "link" table between eitherUserandTags, orProfileandTags...