I have several user defined table-valued functions and one view wich have same columns in returned table. How can I reuse return table definition?
A:
In SQL Server 2008, you can use a User-Defined Table Type.
Prepare for a lot of copy-and-pasting.
(Edit: Apparently you can't return a UDTT from a UDF. It would have made sense, but there's just no syntax for it. So it's either copy and paste, or use an inline table-valued UDF if you can.)
Aaronaught
2010-02-16 21:14:17
I can use any. I;m just not sure what syntax I should use. I tried returning table type but SQL Server says function should return scalar value. Do you have any idea what syntax I should use?
Sergej Andrejev
2010-02-16 23:44:45
@Sergej: As I mentioned in my edit, you can't use a UDTT in this case. Sorry for the misunderstanding. It seems like you should be able to, but there is no syntax that works.
Aaronaught
2010-02-17 00:00:18