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 |
|
andrix
Starting Member
1 Post |
Posted - 2005-09-29 : 17:58:44
|
| HI!I want to do a function in sql that run me a query, the function may take one argument of type varchar (that in it come the query) and must return a table. how can i do it?something like this...CREATE FUNCTION runQuery ( @consulta nvarchar(4000) ) returns @cedulas TABLE (cedula int not null)AS BEGIN.............END |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2005-09-29 : 18:23:03
|
| YOu can't run dynamic SQL in a function.CODO ERGO SUM |
 |
|
|
rockmoose
SQL Natt Alfen
3279 Posts |
Posted - 2005-09-29 : 18:55:09
|
I think you want alternative ways to accomplish this.If you are creating the SQL to pass to the function somewhere, why would you want a function to execute it for you ?(even if it were possible)Why not just do the work where you would call the fn (since you already did the work!)You'r not letting the users pass in arbitrary sql to the server from a front-end application are you ?Edit:Welcome to SQL Team! |
 |
|
|
|
|
|