Lee posted on July 31, 2008 19:41

Table variables become more flexible with SQL 2005

To be honest with you, I hadn't run across this before, either in any of the documentation or new TSQL features. Maybe I missed it I have no idea. Anyway, while blasting away at code one day last week i didn't think twice about it when it worked. That is, until I tried it in SQL 2000 and it blew. Extremely handy in my opinion, now I wish they'd make EXEC possible inside of a UDF!



DECLARE @table table (ID intval char (1))

INSERT @table
    
EXEC ('SELECT 1, ''a'''
)

SELECT * FROM @table



------------------

Great invention by me!!!



blog comments powered by Disqus

by Lee Everest, M.S.

Poll

Do you use Azure or cloud in your organization?



Show Results

Ads

Search


Month List

Calendar

«  February 2012  »
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
2728291234
567891011
View posts in large calendar

Tags

Disclaimer
The opinions, code, examples, et.al. expressed herein are my own personal opinions and do not represent my employer's view in any way, shape form, or fashion.  All code for demonstration purposes - no guarantees, either written or implied, are made.

© Copyright 2012 Lee Everest's SQL Server, etc. weblog