Author |
Topic |
vishu.av
Starting Member
26 Posts |
Posted - 2007-04-18 : 06:50:04
|
I am trying to use a 'string' column in where clause as belowexample:select * from MYTABLE where COLUMNNAME >= ''Apparently COLUMNNAME is of varchar(12) datatypeMy Problem is The above query returns all the records in SQL Server 2000 where as It returns NO ROWS in oracle 9i.Please let me know how to return NO ROWS ( as in Oracle ) modifying the query above in SQL server 2000 |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-04-18 : 06:52:02
|
Why you are trying to do by this query? What is the purpose?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
|
|
vishu.av
Starting Member
26 Posts |
Posted - 2007-04-18 : 07:57:46
|
Hi,I am working on a porting project ( oracle to SQL ).I couldn't find equivalent query for not fetching me any rows when comparing with >= '' |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-04-18 : 08:03:30
|
It depends.What are the data, and which records are you trying to fetch?Peter LarssonHelsingborg, Sweden |
|
|
vishu.av
Starting Member
26 Posts |
Posted - 2007-04-18 : 08:09:40
|
Hi PeterIts just few rows of data that comprises of some varchar values and numeric ones.Can you please let me know can i compare string like the one i am using above.Select * from MyTable where ColumnName >= '' --Column name can be a name of a person |
|
|
vishu.av
Starting Member
26 Posts |
Posted - 2007-04-18 : 08:09:49
|
Hi PeterIts just few rows of data that comprises of some varchar values and numeric ones.Can you please let me know can i compare string like the one i am using above.Select * from MyTable where ColumnName >= '' --Column name can be a name of a person |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-04-18 : 08:15:09
|
Select * from MyTable where ColumnName > '' to avoid select empty records over columnnamePeter LarssonHelsingborg, Sweden |
|
|
vishu.av
Starting Member
26 Posts |
Posted - 2007-04-18 : 10:02:20
|
Hi Peter,Thanks for the replyI am afraid the Query above fetch indifferent results on SQL server and Oracle 9i. |
|
|
vishu.av
Starting Member
26 Posts |
Posted - 2007-04-18 : 10:10:47
|
Hi Friends,I got the clue.Select * from MyTable where ColumnNames >= 'NULL' in SQL Server 2000 is same as Select * from MyTable where ColumnNames >= '' in Oracle 9iIf we donot specify NULL in quotes the result is simply otherwise..ThanksvishuBangalore |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-04-18 : 10:17:09
|
What about this then?declare @t table( a varchar(50))insert @tselect 'xxx'select * from @t where a >= 'NULL' Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
|
|
vishu.av
Starting Member
26 Posts |
Posted - 2007-04-19 : 08:22:27
|
HI HARSH,USE NULL WITHOUT SINGLE QUOTES, I GUESS IT SHOULD WORK.THANKSvishuBangalore |
|
|
|