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 |
|
victord
Yak Posting Veteran
64 Posts |
Posted - 2003-01-22 : 09:04:55
|
| Hi folks,I am trying to concatenate data in a column of a table with zeroes,'000'where ever the figures are 2 or more e.g '45' becomes '45000. But i am getting datatype errors. The datatype of the column is int , but then has data of more than 6 figures e.g '100000'.Below is an example scipt:update stahemog2set module_mark = '__' + '000'WHERE (module_mark <> '0')AND (module_mark LIKE '__')But i am getting the following error:Server: Msg 245, Level 16, State 1, Line 1Syntax error converting the varchar value '__000' to a column of data type int.What am i doing wrong hereThanks Vic |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2003-01-22 : 09:11:28
|
| You can't concatenate a numeric column. It can only be manipulated through arithmetic functions. Basically you want to multiply the column by 1000, if its value is greater than or equal to 10:UPDATE stahemog2SET module_mark = module_mark * 1000WHERE module_mark >= 10 |
 |
|
|
victord
Yak Posting Veteran
64 Posts |
Posted - 2003-01-22 : 09:38:23
|
| [quote]You can't concatenate a numeric column. It can only be manipulated through arithmetic functions. Basically you want to multiply the column by 1000, if its value is greater than or equal to 10:UPDATE stahemog2SET module_mark = module_mark * 1000WHERE module_mark >= 10 [/Thanks for your help again that was spot on.] |
 |
|
|
|
|
|