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 |
|
pelegk2
Aged Yak Warrior
723 Posts |
Posted - 2006-02-13 : 01:55:16
|
| i have a select which i build as a stringand execute the string with[CODE]Exec(strSql)[/CODE]how do i return the result from the function and what is the return value that i should (or dont have to)define at the begining of the function?thnaks in advancepelegIsrael -the best place to live in aftr heaven 9but no one wan't to go there so fast -:) |
|
|
shallu1_gupta
Constraint Violating Yak Guru
394 Posts |
Posted - 2006-02-13 : 02:16:10
|
| Hi,Its better to use a stored procedure since you cannot insert the output of an exec statement in a table variable.you can store the output of your exec statement in a temp table in an SP and use select <column names > from <temptable> |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-02-13 : 03:11:42
|
| You cant use Dynamic SQL inside a Function, the correct way is to use Stored Procedure as suggested. Without dynamic SQL, you can have a function that returns data as TableMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|