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
 Simple Select

Author  Topic 

macca
Posting Yak Master

146 Posts

Posted - 2009-02-10 : 07:10:06
I anm selecting records from a table, I am selecting on record_id. Some of the record Id's start with 'wh' e.g. WH0945. I want to select everything from the table except any records whose record_id starts with 'WH'.
Anyone know how to do this.

Thanks,
macca

Jai Krishna
Constraint Violating Yak Guru

333 Posts

Posted - 2009-02-10 : 07:11:04
select * from urtable where record_id not like 'wh%'

Jai Krishna
Go to Top of Page

Nageswar9
Aged Yak Warrior

600 Posts

Posted - 2009-02-10 : 07:11:34
select* from urtable where record_id not like 'wh%'
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-02-10 : 07:12:32
select * from urtable where record_id not like 'wh%'
or record_id is null

if you accept NULL for record_id value. And if you have a case sensitive collation, you will have to take care of that too.


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

macca
Posting Yak Master

146 Posts

Posted - 2009-02-10 : 07:33:15
Thanks everyone for the help, that worked for me.

macca
Go to Top of Page

Jai Krishna
Constraint Violating Yak Guru

333 Posts

Posted - 2009-02-10 : 07:33:54
Welcome

Jai Krishna
Go to Top of Page
   

- Advertisement -