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 2000 Forums
 Transact-SQL (2000)
 Multiple table replacement values?

Author  Topic 

adlo
Posting Yak Master

108 Posts

Posted - 2004-11-30 : 12:45:52
I have an application that needs to customize messages per user

Here are my tables:

USER TABLE
User_ID int,
Name varchar(100)

USER_MESSAGE TABLE --Links a user to a message
User_ID int,
Message_ID int

KEYWORD TABLE
Keyword_ID int,
Keyword varchar(100)
[1,&Greeting;]
[2,&Header;]
[3,&Footer;]
[4,&Custom1;]
[5,&Custom2;]
etc


MESSAGE TABLE
Message_ID int,
Message varchar(8000)
[1,'...']
[2,'...']
[3,'...']
etc
--Messages contain variables e.g. &Greeting; &Footer; &Header; &Custom1; &Custom2; ....
--These variable values must gets looked up and translated using the User_Keyword Table

USER_KEYWORD TABLE -- Each user has unique keywords
User_ID int,
Keyword_ID int,
Value varchar(100)
[1,1,'Howzit']
[2,1,'Hi']
etc

My question is:
I want to somehow do multiple(X) Replaces on Message using the User_Keyword Table for translating the keywords.

I guess one has to write a UDF to do this but this is bit beyond me.

If anyone can point me in the right direction or if anyone has a sql for a similar situation I would really appreciate it if you could share it with me.

Thanks.





tuenty
Constraint Violating Yak Guru

278 Posts

Posted - 2004-11-30 : 15:49:43
can you post a before update and after update data


Update USER_KEYWORD
set Value = @newValue
Where User_ID = @User_ID and Keyword_ID = @Keyword_ID


*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*
A candle loses nothing by lighting another candle
Go to Top of Page
   

- Advertisement -