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 |
|
Clas
Starting Member
33 Posts |
Posted - 2009-08-20 : 06:09:41
|
| Hi.How to convert nvarchar to intIt is an "make table" query.Source Table:Value nvarchar (50)Value = 3Value = 4Value = 50Value = 72CASE ValueWHEN <=5 THEN 0 (int)WHEN >5 THEN 1 (int)ENDAS ValueInt |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-08-20 : 06:11:52
|
CASEWHEN Value > 5 THEN 1ELSE CAST(0 AS INT)END AS ValueInt N 56°04'39.26"E 12°55'05.63" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-08-20 : 06:16:01
|
You can also make this directly in your "make table" query.SELECT *, CAST( somecol AS int) AS [get the value as int],CAST( somecol AS int) / 6 AS [get the value as flagged directly]INTO #TempFROM ... N 56°04'39.26"E 12°55'05.63" |
 |
|
|
Clas
Starting Member
33 Posts |
Posted - 2009-08-20 : 07:03:48
|
| THANKS ! |
 |
|
|
|
|
|