December 15, 2010 at 12:46 am
Jeff Moden (12/14/2010)I'm not sure I'd call them dangerous (by themselves, they won't cause any damage, I think) but they sure are false. Heh... it's proof positive that the internet is STILL a well paved on-ramp to a dirt road. 😉
Once there was a junior developer who thought he couldn't use constraints on a table variable so used a temp table instead, but since he didn't want the content to be rolled back if the transaction failed he copied the contents of the temp table into a table variable every time it was modified (the unique constraint some columns of the table was enforced by doing everything in a temp table before putting it into the table variable which would be used for logging). Resulting code comprehensibility was not good. Neither was resulting performance. I tried to dissuade him by suggesting that a unique constraint on the table variable would do the job, but he KNEW you couldn't do that with a table variable because he had read in on the internet, so I had to resort to kippered herrings (much more effective than pork chops, btw). So from his point of view the myth was indeed dangerous. 😀
Tom
December 15, 2010 at 7:09 am
Tom.Thomson (12/15/2010)
Jeff Moden (12/14/2010)I'm not sure I'd call them dangerous (by themselves, they won't cause any damage, I think) but they sure are false. Heh... it's proof positive that the internet is STILL a well paved on-ramp to a dirt road. 😉
Once there was a junior developer who thought he couldn't use constraints on a table variable so used a temp table instead, but since he didn't want the content to be rolled back if the transaction failed he copied the contents of the temp table into a table variable every time it was modified (the unique constraint some columns of the table was enforced by doing everything in a temp table before putting it into the table variable which would be used for logging). Resulting code comprehensibility was not good. Neither was resulting performance. I tried to dissuade him by suggesting that a unique constraint on the table variable would do the job, but he KNEW you couldn't do that with a table variable because he had read in on the internet, so I had to resort to kippered herrings (much more effective than pork chops, btw). So from his point of view the myth was indeed dangerous. 😀
[Sigh]
So many people need to see my presentation... maybe at SQL Rally??? I'm counting on you guys to vote for it next month!
[/Sigh]
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
December 15, 2010 at 7:16 am
No one can tell you when to use table variables and when to use temp tables. Each you need to decide which is performing well...
I would suggest you go thorugh the difference between Table Variables & Temp tables, that will help you to decide when to use temp table & table variables.
Abhijit - http://abhijitmore.wordpress.com
December 15, 2010 at 2:42 pm
WayneS (12/15/2010)
[Sigh]So many people need to see my presentation... maybe at SQL Rally??? I'm counting on you guys to vote for it next month!
[/Sigh]
Wayne, I wish I could get there, but I'm on the wrong continent, in a place where air service is restricted to very few destinations (none of them in the USA), and I don't have the money to spend on the trip anyway.
Tom
December 15, 2010 at 2:48 pm
Tom.Thomson (12/15/2010)
WayneS (12/15/2010)
[Sigh]So many people need to see my presentation... maybe at SQL Rally??? I'm counting on you guys to vote for it next month!
[/Sigh]
Wayne, I wish I could get there, but I'm on the wrong continent, in a place where air service is restricted to very few destinations (none of them in the USA), and I don't have the money to spend on the trip anyway.
We're planning to reschedule it for the LV UG in January - they meet at 6:30PM PST - it will be done via LiveMeeting - is that something that you'll be able to watch remotely?
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
December 15, 2010 at 9:37 pm
Tom.Thomson (12/15/2010)
Jeff Moden (12/14/2010)I'm not sure I'd call them dangerous (by themselves, they won't cause any damage, I think) but they sure are false. Heh... it's proof positive that the internet is STILL a well paved on-ramp to a dirt road. 😉
Once there was a junior developer who thought he couldn't use constraints on a table variable so used a temp table instead, but since he didn't want the content to be rolled back if the transaction failed he copied the contents of the temp table into a table variable every time it was modified (the unique constraint some columns of the table was enforced by doing everything in a temp table before putting it into the table variable which would be used for logging). Resulting code comprehensibility was not good. Neither was resulting performance. I tried to dissuade him by suggesting that a unique constraint on the table variable would do the job, but he KNEW you couldn't do that with a table variable because he had read in on the internet, so I had to resort to kippered herrings (much more effective than pork chops, btw). So from his point of view the myth was indeed dangerous. 😀
Heh... kippered herrings. I've heard that if you can keep them going head first, they a whole lot more accurate than pork chops with a wobble. 😛 I think I've learned how to use their pectoral fins as hooks so that I can launch them from a Wrist Rocket sling shot. Still practicing...
Now that you've pointed out how badly the myths of Temp Tables and Table Variables can be manifested in the hands of a know-it-all, I absolutely agree... it's "dangerous code".
--Jeff Moden
Change is inevitable... Change for the better is not.
December 15, 2010 at 9:38 pm
WayneS (12/15/2010)
[Sigh]So many people need to see my presentation... maybe at SQL Rally??? I'm counting on you guys to vote for it next month!
[/Sigh]
I absolutely agree with that. Lot's of good info in that presentation. Both Roy Ernest and I can vouch for that.
--Jeff Moden
Change is inevitable... Change for the better is not.
December 16, 2010 at 4:37 pm
WayneS (12/15/2010)
We're planning to reschedule it for the LV UG in January - they meet at 6:30PM PST - it will be done via LiveMeeting - is that something that you'll be able to watch remotely?
If I know the date in advance I can try - that's about 2:30am here, so it will depend on whether I had to be up and bouncing early both the previous day and that day. Assuming I can get LiveMeeting to work on this laptop (usually do meetings using Skype video conferencing, so don't know about LiveMeeting).
edit: preliminary looks at LiveMeeting are unpromising - I don't think there's an office 2003 standard version of LiveMeeting (or if there is, I can't find it) so I guess it was only in Office 2003 professional, and I don't have that (and it's no longer for sale). I definitely don't want to upgrade to Office 2007 or Office 2010 until I upgrade my whole platform, so it looks as if I won't be able to watch it.
Tom
December 16, 2010 at 5:08 pm
Tom.Thomson (12/16/2010)
WayneS (12/15/2010)
We're planning to reschedule it for the LV UG in January - they meet at 6:30PM PST - it will be done via LiveMeeting - is that something that you'll be able to watch remotely?If I know the date in advance I can try - that's about 2:30am here, so it will depend on whether I had to be up and bouncing early both the previous day and that day. Assuming I can get LiveMeeting to work on this laptop (usually do meetings using Skype video conferencing, so don't know about LiveMeeting).
edit: preliminary looks at LiveMeeting are unpromising - I don't think there's an office 2003 standard version of LiveMeeting (or if there is, I can't find it) so I guess it was only in Office 2003 professional, and I don't have that (and it's no longer for sale). I definitely don't want to upgrade to Office 2007 or Office 2010 until I upgrade my whole platform, so it looks as if I won't be able to watch it.
You can buy it separate, and there's a 30 day trial available, in case you were still curious.
Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.
For better assistance in answering your questions[/url] | Forum Netiquette
For index/tuning help, follow these directions.[/url] |Tally Tables[/url]
Twitter: @AnyWayDBA
December 16, 2010 at 5:25 pm
I didn't have to pay anything for it... when I clicked on a LiveMeeting link, it allowed me to just download it.
Contact Jason as to the date of the meeting. I believe that it will be on Jan 13,2011.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
Viewing 10 posts - 31 through 39 (of 39 total)
You must be logged in to reply to this topic. Login to reply