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 |
|
yulichka
Starting Member
2 Posts |
Posted - 2008-09-29 : 14:06:48
|
| How to convert string to How to convert string to integer?? |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-29 : 14:18:54
|
| use CAST or CONVERThttp://doc.ddart.net/mssql/sql70/ca-co_1.htm |
 |
|
|
shan
Yak Posting Veteran
84 Posts |
Posted - 2008-09-29 : 14:23:10
|
| Use cast function DECLARE @myval varchar(10)SET @myval = '193'SELECT CAST(@myval AS int) -- Or, using CONVERTSELECT CONVERT(int, @myval |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-29 : 14:25:52
|
quote: Originally posted by shan Use cast function DECLARE @myval varchar(10)SET @myval = '193'SELECT CAST(@myval AS int) -- Or, using CONVERTSELECT CONVERT(int, @myval)
mind the braces |
 |
|
|
shan
Yak Posting Veteran
84 Posts |
Posted - 2008-09-29 : 15:16:01
|
| thanks for correcting :-) |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-09-30 : 04:07:22
|
quote: Originally posted by shan Use cast function DECLARE @myval varchar(10)SET @myval = '193'SELECT CAST(@myval AS int) -- Or, using CONVERTSELECT CONVERT(int, @myval
Provided it has no special characters or alphabetsMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|