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
 Case Statemnt for Like

Author  Topic 

akpaga
Constraint Violating Yak Guru

331 Posts

Posted - 2012-11-21 : 12:33:55
Hi friends,

I have table with following coloumns

id, customerCode
123_Regular, Cust1
345_Weekly,Cust1
36_Weekly,Cust1


From the above data I want to to select the weekly and regular customers as separate data

just using one query with a Customertype parameter being passed from the front end.

when The user chooses 'weekly' as CustomerType compare with the id field and get all the id's with weekly in them and same for 'Regular'

Just has to be one select statement.


Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2012-11-21 : 12:41:33
I don't understand what you want.

Here are some links that might help ask your question more clearly:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2012-11-21 : 12:42:15
WHERE ID LIKE '%' +Parameter + '%'

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page

akpaga
Constraint Violating Yak Guru

331 Posts

Posted - 2012-11-21 : 15:35:51
Thank you Lamprey and jimf for the responses..
Got it with you help.

Go to Top of Page
   

- Advertisement -