tSQL: Drop Temp Table if Exists

Posted by SteveHardie | On: Feb 26 2014 | Comments (0)
This article describes how to check if a temporary table exists before you delete it. IF OBJECT_ID('tempdb..#tmpTable') IS NOT NULL DROP TABLE #tmpTable'

How To: MS SQL Reseed or Reset Identity Column

Posted by SteveHardie | On: Jan 20 2013 | Comments (0)
DBCC CHECKIDENT can reseed (reset) the identity value of the table. For example, YourTable has 25 rows with 25 as last identity. If we want next record to have identity as 35 we need to run following T SQL script in Query Analyzer. DBCC CHECKIDENT ([YourTableName],...

SQL 2008: Truncate or Srink a large Log File

Posted by SteveHardie | On: Nov 23 2011 | Comments (0)
I had a problem with a SQL Server 2008 database that had a log file in excess of 90gb, when the DB file itself was less than 2gb. Using the SQL Server Managment Studio to Backup, or Shrink File did not reduce the log file size. In previous versions of SQL, you...

MS SQL: If Statment within Select

Posted by SteveHardie | On: Jun 17 2010 | Comments (0)
When creating a SELECT query, sometimes you may want to display a dynamic field with a different value depending on a certain condition. Below is an example of how to use an IF Statment for creating a column within a select query: SELECT Field1, Field2, PriceField ...

VBScript: Sleep

Posted by SteveHardie | On: Mar 10 2010 | Comments Off on VBScript: Sleep
VBScript does not implicity allow the Sleep command that you can use in the VB Programming language, to force the script to pause for an amount of time is accomplished by using the Sleep API call. API stands for Application Programming Interface. They are functions...