October 26, 2007 at 9:45 am
I have a column with Varchar(100) and it allows to enter numbers but it also allows to enter date like '1/3/1998' which ia wrong entry, I am not supposed to change the design but when i check to see if there is any data less than 1, i get an error
Syntax error converting the varchar value '1/3/1998' to a column of data type int.
how can i check with out getting this error.
October 26, 2007 at 9:47 am
look in BOL under ISNUMERIC()
______________________________________________________________________
Personal Motto: Why push the envelope when you can just open it?
If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.
Jason L. SelburgOctober 26, 2007 at 9:51 am
where isnumeric(fieldname) = 1
and convert(int, fieldname) < 1
October 26, 2007 at 10:00 am
Mike Levan (10/26/2007)
I have a column with Varchar(100) and it allows to enter numbers but it also allows to enter date like '1/3/1998' which ia wrong entry, I am not supposed to change the design but when i check to see if there is any data less than 1, i get an errorSyntax error converting the varchar value '1/3/1998' to a column of data type int.
how can i check with out getting this error.
VARCHAR will allow users to enter anything they want. Are the values *only* int and mm/dd/yyyy format? Are the int values supposed to be representative of dates? If so you could convert all of them to dates. I still say a staging table will help you deal with your data.
Greg
_________________________________________________________________________________________________
The glass is at one half capacity: nothing more, nothing less.
October 26, 2007 at 2:11 pm
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply