Transact SQL – Drop Temp Table if it it exists

Background Reviewing some Transact SQL Code and saw a code block that works well in exception handling, but can have a bit of side effect in Transact SQL. Code Original Code SQL Explanation When the temp table does not exist, an error is raised. Because the drop table is enclosed in a try/catch block the … Continue reading Transact SQL – Drop Temp Table if it it exists

What datatype is the null value?

Background A few weeks ago, I ran into a Transact SQL problem and I was forced to ask myself why two database objects were not compatible. In the rest of this post, I will share the "foundational"  scenario and try to start answering the question, what datatype is Null.   Scenario Our baseline scenario is to … Continue reading What datatype is the null value?

Microsoft – SQL Server – Error – Error: 17066, Severity: 16, State: 1 // SQL Server Assertion: File: cxrowset.cpp, line=1538 Failed Assertion = ‘pXacc–>FHasVirtualColumn()’. This error may be timing-related

We started getting this "error - Error: 17066, Severity: 16, State: 1:" Due to its severity level 16 and SQL Server's suggested remediation steps: Run DBCC CheckDB (to check database for structural integrity) Restart the server (to ensure in-memory data structures are not corrupted) .... I am thinking I am in for long nights...and not … Continue reading Microsoft – SQL Server – Error – Error: 17066, Severity: 16, State: 1 // SQL Server Assertion: File: cxrowset.cpp, line=1538 Failed Assertion = ‘pXacc–>FHasVirtualColumn()’. This error may be timing-related

MSSQL Server – Database Recovery [Manual] (after a crash) – MS SQL Server v2005 and above

  Tried out Paul Randal’s database recovery steps (http://www.sqlskills.com/blogs/paul/post/TechEd-Demo-Creating-detaching-re-attaching-and-fixing-a-suspect-database.aspx)  and it works a charm --- Note that the database server will try to and most like recover itself.  But, in our case, the time for a successful recovery was too much and so we chose to 'circumvent’ possible recovery by renaming the database log files. … Continue reading MSSQL Server – Database Recovery [Manual] (after a crash) – MS SQL Server v2005 and above