Skip navigation.

Back To Basics: HTMLAll recent postsServer Controls Are a Blessing

Table Manners

Via Ryan Farley came a hysterical snip of T-SQL code which shows severe abuse of tempdb. A dB developer at my previous job introduced me to table variables a while ago as an eggcellent alternative to tempdb. I think table variables are badly overlooked which is why I decided to post this.

Instead of pretending to be a SQL guru (which I'm not) I figured I'd post links to some helpful online resources to get you started with table variables.

Temporary tables have been akin to tables used for page layout. Microsoft has a Knowledge Base article titled SQL Server 2000 - Table Variables which is a good intro. There's an article at SQL Server Magazine which lays it out for you what might befall your application should you push temp tables to the max. There's even a fix from Microsoft for those guilty of tempdb abuse.

For most needs a table variable is a much better alternative to a temporary table. Make sure to read SQL Server 2000 - Table Variables to get both sides of the story. Also, search SQL Server Books Online for table variables.

Comments

No comments yet

Emails and Notifications

Would you like to be notified when somebody responds to this post? 

Submit your comment

Please enter only text since all HTML tags except hyperlinks will be stripped. Hyperlinks will become live links. Any comments with flaming or offensive language will be deleted. Be courteous to other posters. Thank you.

Your name (required):
Your email (optional):
Your site's URL (optional):
Enter this number
Type in the number above:
Comment (required):