Tag Archives: mssql

What happens in EXEC, stays in EXEC. Lifespan of a MSSQL table variable

One of my all time favorite features of MSSQL 2005+ is being able to create table variables on the fly from SELECT statements. This isn’t a lesson in what table variables are, but here is an easy sample in case … Continue reading

Posted in database, development, tsql | Tagged , , , , , , , , | 1 Comment

Select random value from a range of values

Earlier I blogged about creating random numbers using tsql functions.  Here are two techniques for selecting a random value from a pre-defined range of values in a tsql script.  The first technique uses a table variable ( MSSQL 2000 + … Continue reading

Posted in database, development, microsoft, tips and tricks, tsql | Tagged , , , , , , , , | 1 Comment

Store your SQL database in the same location as live

I do a lot of moving of databases between development and production servers.  If I’m lucky, the production server I’m working with gives me access to DTS services, or even the Database publishing wizard.  More often than not however, the … Continue reading

Posted in database, microsoft, SQL, tips and tricks | Tagged , , , | Leave a comment

I built a calendar in a tSQL SPROC

Here’s a blast from the past that I recently found in my archives. It’s a novelty stored procedure I wrote during my MS SQL 2000 DBA days. Back when I wrote this sproc, I was really big into writing calendar … Continue reading

Posted in SQL | Tagged , , , , , , | Leave a comment