473,386 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 1640
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

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

Similar topics

1
by: Michel | last post by:
Hi again all, I have a small issue. Here's an example dataset : F1 F2 F3 1 0.58 Hi 2 0.70 Hello 3 Fail Bye 4 <Null> Hi
19
by: Lauren Quantrell | last post by:
I have a stored procedure using Convert where the exact same Convert string works in the SELECT portion of the procedure but fails in the WHERE portion. The entire SP is listed below....
1
by: SD | last post by:
Hi, This is driving me nuts, I have a table that stores notes regarding an operation in an IMAGE data type field in MS SQL Server 2000. I can read and write no problem using Access using the...
1
by: rob.kellington at gmail | last post by:
Does anyone have the logic to convert RTF formatted data in a text column into plain ascii text that I can use in a varchar variable or field? We have an app that allows formatted comments/notes...
1
by: Woodies_46 | last post by:
Ok i know this is simple but i just don't know the syntax. What I have is a bunch of values and i want to be able to display them as money values with a $ in front. eg. 16000000 1000 160000
1
by: fatmapatlar | last post by:
I have to convert this script, but i didn't. This is stored procedure of sql. I need to convert to postgresql... if it is possible please help me! Thanks Fatma CREATE PROCEDURE...
2
by: santoshpayal | last post by:
Hi, I have a text file that contains a date column. The text file will be imported to database in SQL 2000 server. After to be importing, I want to convert the date column to date type. For...
2
by: kirke | last post by:
Hi, I have a datetime column named dtDateTime. its format is "Oct 27 2006 12:00:00 " I want to group by only date part of it and count my code is $sql1="SELECT ...
8
by: Patti | last post by:
I am new to SQL and have created a stored procedure for a .net web application. Unfortunately I had to use a cursor in the stored procedure, so it is taking several minutes to execute because it...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.