Lee posted on July 31, 2008 17: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

Comments are closed

by Lee Everest, M.S.

Search


Ads

Calendar

«  March 2010  »
MoTuWeThFrSaSu
22232425262728
1234567
891011121314
15161718192021
22232425262728
2930311234
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