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 |
|
real_pearl
Posting Yak Master
106 Posts |
Posted - 2004-08-13 : 07:59:29
|
| Is it possible to pass a table variable to a function? I have seen that functions return table variable but is it possible to pass a table as variable to a function likecreate function fn_test(@table Table)return intasselect * from @tablereturn 1select fn_test(Employees) |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-08-13 : 08:02:26
|
| according to bol no:CREATE FUNCTION [ owner_name. ] function_name ( [ { @parameter_name [AS] scalar_parameter_data_type [ = default ] } [ ,...n ] ] ) scalar_parameter_data_type Is the parameter data type. All scalar data types, including bigint and sql_variant, can be used as a parameter for user-defined functions. The timestamp data type and user-defined data types not supported. Nonscalar types such as cursor and table cannot be specified.Go with the flow & have fun! Else fight the flow :) |
 |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2004-08-13 : 08:24:46
|
| Sadly no, this isn't possible. It would have made my life easier a number of times. You can work around it - setting up tables beforehand, etc. but it's messy.-------Moo. :) |
 |
|
|
|
|
|