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 |
|
ayamas
Aged Yak Warrior
552 Posts |
Posted - 2007-05-05 : 02:07:47
|
| Hi to all the SQL gurus,1) Is it possible to return a set of rows as ouput parameter.I mean if I declare a variable a as a table datatype & set it as a output parameter.So can I return the rows in that table as output parameter.2) What types of datatypes can an output parameter return.P.S - I was asked this questions in an interview.It has nothing to do with any project.So please dont ask for any sample data.Thanks & Regards |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-05-05 : 02:36:34
|
| BoL:"A table variable behaves like a local variable. It has a well-defined scope, which is the function, stored procedure, or batch in which it is declared.Table variables are cleaned up automatically at the end of the function, stored procedure, or batch in which they are defined."You could return data from an SProc an INSERT it into a table, or #TempTable, but not an @TableVar"OUTPUTIndicates that the parameter is a return parameter. The value of this option can be returned to EXEC[UTE]. Use OUTPUT parameters to return information to the calling procedure. Text, ntext, and image parameters can be used as OUTPUT parameters. An output parameter using the OUTPUT keyword can be a cursor placeholder."Kristen |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-05-05 : 08:30:55
|
| Why do you need parameter that returns rows? You can easily use Select statement in the procedure If you want to filter data from the resultset you can export data returned from procedure to a temp table and query on that. Only in Function you can have paramter that returns resultsetMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|