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-12-30 : 10:22:30
|
How to convert a varchar number to decimal with max length 7.select emp_no from employee;emp_no is available in varchar format, now want to convert to decimal.decimal(7,0).example of empnos can be: 320, 7880, 123890, 3425678Thanks a lot for the helpful info. |
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2012-12-30 : 10:34:34
|
Why Decimal?? Can't you convert to int? |
|
|
ScottPletcher
Aged Yak Warrior
550 Posts |
Posted - 2012-12-31 : 11:52:49
|
If you're sure the value is numeric, you can CAST it to the desired data type:CAST(column_name AS decimal(7, 0)) |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-01-01 : 23:56:17
|
decimal with scale value of 0 is as good as integer------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|