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 2005 Forums
 Transact-SQL (2005)
 query plz

Author  Topic 

Mageshkumar
Starting Member

29 Posts

Posted - 2008-08-11 : 08:19:40
Hi i have a table like this,

Id dep mar
100 MCA,MBA,MSC 80
101 B.Sc,BBA,MCA 60
102 B.Tech,MBA 60

Now if i give Dep=MCA the i need o/p id 100 & 101 have to come

give me a query for this

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-11 : 08:21:21
declare @searchstr varchar(100)
set @searchstr='MCA'
select * from Yourtable where ','+dep+',' LIKE '%,'+@searchstr + ',%'
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-08-11 : 08:39:03
Also read about Normalisation

Madhivanan

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

- Advertisement -