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 |
cplusplus
Aged Yak Warrior
567 Posts |
Posted - 2012-09-13 : 07:47:39
|
I want to get three fields value concatenated to one field @ModTitle , i am getting syntax issue wth quotes can you please help.Getting this error message: Incorrect syntax near 'lblLogType'.Set @ModTitle = (Select etext from tab_picklists where Pickid = @MastertypeID and fieldkey=' + CHAR(39) + 'lblLogType' + CHAR(39) +')+ ' +'''-'''+ ' + convert(nvarchar(50), SeqNo) + ' +'''-'''+ ' + RMTitle as RMTitle from tab_rm where rmid=@ModRecordID') Thanks a lot for the helpful info. |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-09-13 : 08:12:11
|
So what you want is this???{ValueOf tab_picklists.etext} + '-' + {ValueOf tab_rm.SeqNo} + '-' + {ValueOftab_rm.RMTitle}or am I wrong? Too old to Rock'n'Roll too young to die. |
 |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-09-13 : 08:16:38
|
If so then try this:Set @ModTitle = (Select etext from tab_picklists where Pickid = @MastertypeID and fieldkey='lblLogType')+ '-' +(Select convert(nvarchar(50), SeqNo) + '-' + RMTitle from tab_rm where rmid=@ModRecordID) Too old to Rock'n'Roll too young to die. |
 |
|
cplusplus
Aged Yak Warrior
567 Posts |
Posted - 2012-09-13 : 08:54:36
|
thks a lot Fred. |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-09-13 : 10:21:18
|
make sure you wrap them inside COALESCE(col,'') to avoid making result as NULL in case any of fields are of nullable type------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|