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
 Transact-SQL (2000)
 In and like operator together

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-04-27 : 08:56:24
Deep writes "i want to use in and like operator together in a single sql statement"

samsekar
Constraint Violating Yak Guru

437 Posts

Posted - 2004-04-27 : 10:48:39
HTH..
SElect * from northwind..employees
where employeeid in (2,9) or LastName like 'pea%' or lastname like 'Buch%'

- Sekar
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2004-04-28 : 13:50:30
$1000US They want to do

SELECT *
FROM Orders
WHERE CustomerID LIKE ('VI%','TO%')


Nope...

BUT!


USE Northwind
GO
CREATE TABLE myTable99(Col1 char(2))

INSERT INTO myTable99(Col1)
SELECT 'VI' UNION ALL SELECT 'TO'

SELECT *
FROM Orders o
INNER JOIN myTable99
ON CustomerID LIKE Col1+'%'
GO

DROP TABLE myTable99
GO



Should float your boat...



Brett

8-)
Go to Top of Page
   

- Advertisement -