Justin Cooney
Web Development Tips and Examples
Author: Justin Cooney
-
Temporary tables and table variables in SQL Server actually perform quite differently under different circumstances. Temporary tables are decelared as: CREATE Table #TableName ( id INT ) Table variables are declared as: DECLARE @TableName TABLE ( id INT ) Temporary tables are transaction bound whereas table variables are not. This means that if a transaction in…
-
With SQL Server 2008 Microsoft has added .NET like error handling to SQL Server by adding support for TRY – CATCH blocks. I like this new feature since the old @@ERROR syntax was quite unwieldy and the TRY – CATCH just seems more intuitive to use. Here are some of the features of the new TRY –…
-
Sometimes it is useful to be able to search for the number of occurrences of a particular word or phrase within a table column. Although one can use a cursor and calculate the word count in a loop it much more efficient to do the calculations within a single statement. Here is the Transact-SQL query…