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.
| Author |
Topic |
|
MrDinoC
Starting Member
1 Post |
Posted - 2010-10-19 : 07:40:23
|
| Hi,I have a spreadsheet with a list of names, these names on my database have departments specific to them. what i want to do in my query is, not have to select a name from my spreadsheet individually but all at once, then run a query which will bring the departments up. can i concatinate these names in my LIKE field?SELECT ca_owned_resource.resource_name, ca_contact.last_nameFROM ca_owned_resource INNER JOINca_contact ON ca_owned_resource.resource_contact_uuid = ca_contact.contact_uuidWHERE (ca_owned_resource.resource_name LIKE 'ACKRFAX01') AND (ca_owned_resource.inactive = 0)What i want is for my query to bring up all |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-10-19 : 07:52:46
|
Since you are not using any joker there is no need to use LIKE.You can use IN():WHERE ca_owned_resource.resource_name IN('ACKRFAX01','ACKRFAX02','BBKRFAX07')AND ca_owned_resource.inactive = 0 No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-10-19 : 12:49:59
|
| for getting values from spreadsheet in your query you might have to use distributed query like OPENROWSET------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|