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)
 Build SQL from another results set

Author  Topic 

loydall
Starting Member

33 Posts

Posted - 2009-04-20 : 05:07:19
Hi,

I am passing an XML section to a stored procedure and then running a query against this and returning a table of results. This works fine but what I need to do is actually use those results to form a query - so my results look like:

FieldName | FieldValue
----------------------
Name | John
Age | 33
Location | London

And I want to use those results to build a query like:

SELECT * FROM someTable WHERE Name = 'John' AND Age='33' AND Location='LONDON'

How do I do that?

Thanks

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-04-20 : 05:26:33
Much as I showed you in this topic
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=123850


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -