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
 Like operator

Author  Topic 

govindts
Starting Member

33 Posts

Posted - 2009-02-03 : 19:03:28
Hello - I am new to sqlserver..

The below query is returning zero records.. I am oracle person and it works in oracle. But not in sqlserver. Can any one please let me know??

create table test(materialdesc varchar(50))

insert into test values('3rd Party testing..')

select * from test where materialdesc NOT LIKE '%3rd Party%'

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-02-03 : 19:13:25
It is supposed to return zero records for your example. If you want it to return the row you inserted, then remove NOT from your query:

select * from test where materialdesc LIKE '%3rd Party%'

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

govindts
Starting Member

33 Posts

Posted - 2009-02-03 : 19:37:25
Sorry. That was my bad. sorry again.

quote:
Originally posted by tkizer

It is supposed to return zero records for your example. If you want it to return the row you inserted, then remove NOT from your query:

select * from test where materialdesc LIKE '%3rd Party%'

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog


Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-02-03 : 19:42:38
No problem, sometimes it just takes another set of eyes to figure out what is wrong.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -