ADO.NET calling T-SQL Stored Procedure causes a SqlTimeoutException

Once I determined that it is the ADO.NET connection at the root of the problem, this thread led me to the answer. Basically connections through Sql Server Management Studio (SSMS) by default have SET ARITHABORT ON. ADO.NET connections do not. Setting ARITHABORT OFF and executing the query directly through SSMS gives me the same slow … Read more

In SQL Server, how can I lock a single row in a way similar to Oracle’s “SELECT FOR UPDATE WAIT”?

You’re probably looking forwith (updlock, holdlock). This will make a select grab an exclusive lock, which is required for updates, instead of a shared lock. The holdlock hint tells SQL Server to keep the lock until the transaction ends. FROM TABLE_ITEM with (updlock, holdlock)

How can I execute a single query in SQL Server Management Studio?

I did some searching and was unable to find any keyboard shortcuts for executing individual lines in SSMS. There is a reference online though. http://msdn.microsoft.com/en-us/library/ms174205.aspx Personally I just highlight the row in question (Shift + End or Shift + ↓, etc.) and hit F5. Ctrl + E works just as well on a Mac.

SQL Server error “Implicit conversion of because the collation of the value is unresolved due to a collation conflict.”

You’d need COLLATE in both places most likely. Select City COLLATE DATABASE_DEFAULT AS Place, State, Country FROM DEPT1 UNION ALL Select ” COLLATE DATABASE_DEFAULT AS Place, ‘Arizona’ As State, Country FROM DEPT2 Edit: You may need it on every string if you get it in one places Select City COLLATE DATABASE_DEFAULT AS Place, State COLLATE … Read more