Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Varchar to int
Message
From
20/09/2004 10:38:27
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Varchar to int
Miscellaneous
Thread ID:
00944009
Message ID:
00944009
Views:
50
I have a table having a field called 'answer' is Varchar. We need change all values to Int.

678 TO 678 (INT to INT don't change)
Y TO 1
N TO 0
5.56 TO 556 (Real to INT by time 100, this is price)

I used

questionresponse=
case
when isnumeric(answer)=1 then answer -- need change
when isnumeric(answer)=0 and answer= 'Y' then '1'
when isnumeric(answer)=0 and answer= 'N' then '0'
when isnumeric(answer)=0 and answer= '-' then '0'
end

The only thing is how can we figure out which one is real. Do we have the function to identify Int and Real like isreal?


Thanks


Jim
Next
Reply
Map
View

Click here to load this message in the networking platform