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!!!



Comments

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading




by Lee Everest, M.S.

Search


Ads

Calendar

«  July 2010  »
MoTuWeThFrSaSu
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678
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 2010 Lee Everest's SQL Server, etc. weblog