468,316 Members | 2,106 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,316 developers. It's quick & easy.

How to convert a Varchar into a Int with sql 2000?

I have a sql 2000 Database table that I am trying to compare the data.The Data that i Am working with is a Varchar and I want to compare it to an int value. Currently now when I do this is does not take check all values. I am trying to see if the varchar is smaller than the int value. How can I convert the varchar value into a Int with the SQL Select Statement.
Sep 16 '08 #1
1 1491
code green
1,726 Expert 1GB
You can use CAST or CONVERT
Expand|Select|Wrap|Line Numbers
  1. SELECT CAST(varcharfield AS INT) FROM tablename
  2. SELECT CONVERT(INT, varcharfield ) FROM tablename
Sep 16 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

19 posts views Thread by Lauren Quantrell | last post: by
1 post views Thread by rob.kellington at gmail | last post: by
1 post views Thread by Woodies_46 | last post: by
2 posts views Thread by kirke | last post: by
8 posts views Thread by Patti | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.