|
Posted by Erland Sommarskog on 07/21/05 01:14
Highlander416 (rbradford@gmail.com) writes:
> Does anyone have any ideas as to how I can dynamically execute this
> query? The reason I say dynamic is I need this same comparison for
> about 25 different tables. Thanks!
You cannot invoke dynamic SQL from a user-defined function.
I don't really get a grip of what you are trying to do. Even less why.
And that would be kind of interesting to know.
Because, normally, if find yourself wanting to do such a thing, it's
a strong indication that there is a problem with the data model. Then
again, it could be OK, if this is for some special purpose, for instance
auditing or reconciliation, and part of the main application code.
If you can expand on the underlyingh business problem you have, it may
be easier to suggest a strategy.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp
[Back to original message]
|