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 |
|
amao
Starting Member
2 Posts |
Posted - 2009-06-27 : 07:27:46
|
| hi all I have this update statement update links set ShortS=(local+'/'+Hid) where hid =(select top 1 hid from links order by hid desc)note : Hid is integer and local is nvarcharit gives "Conversion failed when converting the nvarchar value 'local/' to data type int." |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-06-27 : 07:30:47
|
local + '/' + convert(nvarchar(20),Hid) No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-06-27 : 07:40:46
|
Because when you try to use the + sign in combination with numeric data types sql tries to make addition.If all values are data type character there is no problem to use the + sign for concat.btw.: Maybe instead of your subselect you can use (select max(hid) from links) to get highest Hid without being cruel to the server .Fred No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
amao
Starting Member
2 Posts |
Posted - 2009-06-27 : 08:54:42
|
| thanx Webfred very helpful |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-06-27 : 08:55:43
|
welcome  No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|