December 18, 2012 at 6:53 am
Well, this was an easy one!
You can use table variables in some type of functions, but not in all. You can't use(declare) a table variable in an inline table valued function, but you can pass a user defined table parameter.
In an inline table valued function, you can only have one single select statement.
/Håkan Winther
MCITP:Database Developer 2008
MCTS: SQL Server 2008, Implementation and Maintenance
MCSE: Data Platform
December 18, 2012 at 7:00 am
thanks for the easy question.
December 18, 2012 at 7:31 am
Thanks for the semi-easy question. I say semi-easy because I was going to just jump all over it and be like "Yes! Of course you can!" and then the uncertainty hit me and I thought to myself..."This is QotD...so...what's the catch?" After a few moments of deep thought, I went with my gut and got it right.
December 18, 2012 at 10:09 am
Really, really easy one - thanks!
December 18, 2012 at 1:43 pm
Thanks for a good (and not tricky) question.
December 18, 2012 at 2:37 pm
Thanks for the easy one! Should have been "can temp tables" be used in UDFs - that may have fooled a few :hehe:
______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience
December 18, 2012 at 9:23 pm
L' Eomot Inversé (12/18/2012)
Nice easy one today.Perhaps it would have been a good idea to provide the appropriate BoL reference: CREATE FUNCTION (Transact-SQL) which contains the statement
In multistatement table-valued functions, @return_variable is a TABLE variable, used to store and accumulate the rows that should be returned as the value of the function
and that answers the question rather clearly - if some functions have to use a table variable, then certainly functions can use table variables.
+1
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
December 19, 2012 at 12:09 am
Excellent one-point question. 21% wrong answers = no such thing as a too-easy QotD.
Paul White
SQLPerformance.com
SQLkiwi blog
@SQL_Kiwi
January 15, 2013 at 1:37 pm
Nice Question and Easy
January 21, 2013 at 12:01 pm
we can use table variable in UDF's. But performance issues will raise.....:w00t:
Manik
You cannot get to the top by sitting on your bottom.
February 1, 2013 at 7:13 am
used it today !
Viewing 11 posts - 16 through 25 (of 25 total)
You must be logged in to reply to this topic. Login to reply