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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 how do you compare varchar with a number

Author  Topic 

sqlclarify
Yak Posting Veteran

56 Posts

Posted - 2009-06-13 : 21:02:30
I don't understand what I'm doing wrong here..

I have a field employee_type of type varchar2(2byte)

I KNOW there are two rows which have employee_type with a value of '2'.

But when I do select * from employee where employee_type = '2' OR employee_type = 2 I do not get any rows. How do I fix this and what am I doing wrong?

sqlclarify
Yak Posting Veteran

56 Posts

Posted - 2009-06-13 : 21:11:47
Please disregard.. I figured it out.. :)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-14 : 01:28:11
if employee_type values are numeric always, why choose varchar as datatype?
Go to Top of Page
   

- Advertisement -