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 

vsk457
Starting Member

1 Post

Posted - 2008-02-02 : 02:56:13
Using Like operator

I want to display Names ending with XYZ. But, the starting letter should be either A, B OR C.

Example:

AXYZ
BXYZ
CXYZ


Tell me how to do that

Thanks in Advance

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-02-02 : 02:58:45
SELECT ColumnName FROM Table WHERE ColumnName LIKE '%XYZ'

or

SELECT ColumnName FROM Table WHERE RIGHT(ColumnName,3)='XYZ'

or

SELECT ColumnName FROM Table WHERE SUBSTRING(ColumnName,LEN(ColumnName)-2,3)='XYZ'
Go to Top of Page

soori457
Yak Posting Veteran

85 Posts

Posted - 2008-02-02 : 04:11:57
select empname from emp1 where empname LIKE '[abc]xyz'

Suresh Kumar
Go to Top of Page

kiruthika
Yak Posting Veteran

67 Posts

Posted - 2008-02-02 : 09:00:04
Hi!

select empname from emp where empname like'[abc]%[x][y][z]'

kiruthika!
http://www.ictned.eu
Go to Top of Page
   

- Advertisement -