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 |
|
linda9898
Starting Member
28 Posts |
Posted - 2008-04-27 : 03:19:24
|
| Hi ,I have a problem with casting a string number to int.for exmaple i have the number '0110' (string) and i would like it to be 110. or '0001' to be 1.i tried to do:cast(MyNUM as int) .but i get "Syntax error converting the nvarchar value 'O322' to a column of data type int." is anyone have any idea how to solve it ?thanks |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-04-27 : 04:04:09
|
| I dont think its a 0 in begining i think its english alphabet O as per error info.if you need to get only the number from it. use:-SELECT CAST(REPLACE(MyNUM,'O','') AS int) |
 |
|
|
linda9898
Starting Member
28 Posts |
Posted - 2008-04-27 : 04:07:29
|
| it works now , thanks alottttttttttt |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|