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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL Server

Author  Topic 

ansujoseph
Starting Member

1 Post

Posted - 2005-06-20 : 07:11:16
Hi,
I have the following table in SQL Server.

Sname
-----
Ramesh
R
_R
_

Vinay
I need to select all the rows with name as '_' (underscore).
Please help me.

Thanks
Ansu

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-06-20 : 08:10:50
Select * from yourTable where name like '_%'

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-06-20 : 08:16:15
Since underscore is a wildcard character, you need to modify Madhivanan's query a little bit:

Select * from yourTable where name like '[_]%'
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-06-20 : 08:20:11
Rob, Thanks. I did not notice that

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -