//
archives

T-SQL

This category contains 13 posts

Incorrect syntax near “GO”

SQL Error (102): Incorrect syntax near “GO”   DON’T USE NVARCHAR FOR SQL VARIABLES HOLDING BATCHED SQL STATEMENTS WITH IMBEDDED “GO” STATEMENTS…   I recently wrote some code to generate CRUD procedures for a Data Warehouse project and I was receiving an error message on the batch T-SQL “GO” statement when executing the sql code … Continue reading

Set it or Select it?

I get asked this question quite frequently regarding which to use in a T-SQL statement, SET or SELECT. I personally use SET 90% of the time, if for not other reason then my development background(readability). Here’s what I know about the differences between SET  & SELECT: SET is the ANSI standard for assigning values to … Continue reading

Quick & Dirty – Blocking Query Resolution

This technique should be used in extreme emergencies only. It involves identifying the lead blocker and killing his session. Killing transactions can be damaging to your server, so do not use this method without fully understanding the ramifications of what you are doing; there are other (and safer) ways. Lets say that there is an … Continue reading

Concurrency and NOLOCK

There is generally confusion over the effect of the NOLOCK query hint and locking in general when selects are run. A SELECT in SQL Server will place a shared lock on a table row – and a second SELECT would also require a shared lock, and those are compatible with one another. So no – … Continue reading