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 |
|
adlo
Posting Yak Master
108 Posts |
Posted - 2004-11-03 : 14:47:57
|
| I was wondering if it is possible to do the following in sql instead of in the programming language itself.I need to replace the following values in a sting field based on each user.&FirstName;&GenderHeShe;&GenderHisHer;I am writing an app that does a personality assessment.Based on certain questions an numeric score is returned.I have a Comment table which contains string comments based on the score achieved.Comment Table (Links Comment to Category)Comment_ID int,Category_ID int,Comment varchar(8000)Category TableCategory_ID int,CategoryName varchar(10),MinValue int,MaxValue intUser TableUser_IDFirstNameGender bit (0=Female,1=Male)User_Category Table (Links User to a Category)User_ID int,Category_ID intComments sometimes contain the person's name in the stringe.g. I would recommend John because of .....Comments also sometimes contain references to the person's gender e.g. He/She: He is a good workerandHis/Her: Because of his ability ....My questions is:Can one replace these values using SQL? |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-11-03 : 15:03:32
|
use replace function...select replace(stringToReplaceIn, '&FirstName;', Name) from MyTableGo with the flow & have fun! Else fight the flow |
 |
|
|
|
|
|