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 2000 Forums
 SQL Server Development (2000)
 Having a column store sql for dynamic queries

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-01-31 : 09:00:24
Tyler writes "I want to store sql in a column and then execute it at runtime along with a sql statement.

Ideally I would be able to write a query that looks like the following (where ColC is a sql statment):

Select ColA, ColB, function(ColC)...

Ideally it would also be nice to be able to pass in parameters from ColA, ColB aswell.

I'm pretty sure I can't use a user defined function to capture the results from an EXEC or sp_executesql but if not i'd like to know if there's a work around or some way for me to (once again) "store sql in a column and then execute it at runtime as part of a query".

Let me know if that makes any sense.

Thanks so much,
Tyler

I am running Sql Server 2005 on Windows 2003 Enterprise Edition RC2"

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-01-31 : 10:03:57
U can store the query as varchar and run using exec
Go to Top of Page
   

- Advertisement -