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 |
Blessed1978
Yak Posting Veteran
97 Posts |
Posted - 2015-02-19 : 17:09:25
|
When i run the below in sql 2008 it gives an errorhowever in 2012 it runs fine'CONCAT' is not a recognized built-in function name.how can a adjust this to work i sql 2008CONCAT(CONCAT(empid , '@'),(SELECT SettingValue from SETTINGS WHERE Code = 'TEST')) |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2015-02-19 : 17:14:23
|
You can use + to concatenate in all of the versions. Here is an example:select empid + '@' + settingvaluefrom settingswhere code = 'test'Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
Blessed1978
Yak Posting Veteran
97 Posts |
Posted - 2015-02-19 : 17:56:52
|
when i run select [member_id] = e.empid + '@' + settingvalue from settings where code = 'test' from employee eerror message Msg 8114, Level 16, State 5, Line 1Error converting data type varchar to bigint. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2015-02-19 : 19:10:17
|
Use CAST or CONVERT on the bigint column, which I assume is empid. You are concatenating it into a string, so it needs to be a string first.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
|
|
|