|
|
|
|
Browse by Tags
-
SQL Server MVP Erland Sommarskog is hosting a new utility on his web site. Apparently it is very useful. Enjoy! Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it! Read More...
|
-
The following pattern is quite common in database programming: IF EXISTS(some query) BEGIN DO SOMETHING; END When such code runs in high concurrency situations, it may not work as expected. I will provide a repro when such logic fails 40% of the time. Read More...
|
-
In Transact SQL you can assign a 10-character value to a VARCHAR(5) variable, as follows: DECLARE @c VARCHAR ( 5 ); SET @c = '1234567890' ; PRINT @c 12345 The value will be silently truncated without raising an error. Because of this behavior it may be Read More...
|
-
Stored procedures using old-style error handling and savepoints may not work as intended when they are used together with TRY … CATCH blocks. I will provide some examples. This post continues the series on defensive database programming. Avoid calling Read More...
|
-
In most cases LIKE conditions should by followed by ESCAPE clauses. Let me give you an example. Consider the following table, sample data, and stored procedure : CREATE TABLE Data . Messages ( Subject VARCHAR ( 30 ), Body VARCHAR ( 100 )); GO INSERT INTO Read More...
|
-
Yesterday MVP Aaron Bertran posted his "best practices checklist". http://sqlblog.com/blogs/aaron_bertrand/archive/2008/10/30/my-stored-procedure-best-practices-checklist.aspx Among other recommendations, he suggested that all assigments should be done Read More...
|
-
If you do not qualify columns in your query, which means that you do not specify from which tables your columns come, you may have problems if the database schema changes. For example, consider the following sample tables and a select query: CREATE TABLE Read More...
|
-
The behavior of NOT IN clause may be confusing and as such it needs some explanations. Consider the following query: SELECT LastName, FirstName FROM Person.Contact WHERE LastName NOT IN('Hedlund', 'Holloway', NULL) Although there are more than a thousand Read More...
|
-
Apparently test coverage reports are not available for Transact SQL development yet. Because they are very useful in C# development, I submitted a suggestion: https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=375333 Pls vote. Read More...
|
-
Clearly there are many well known and proven ways to store and maintain the configuration settings of your applications. However, where your requirements have outgrown the ‘off the shelf’ methods, such as Active Directory, the relational database can Read More...
|
-
If your data has a small percentage of duplicates, then IGNORE_DUP_KEY may speed up your inserts. For larger amounts of duplicates, IGNORE_DUP_KEY may slow them down significantly. I set up two tables, stripping down all the irrelevant details, as follows: Read More...
|
-
As we know, higher isolation levels acquire more locks and as such they use more CPU, but is the increase significant? In some case the increase is very noticeable, and here are a few benchmarks illustrating my point. Prerequisites: I created the following Read More...
|
-
It's great that you are an MVP! Well done! https://mvp.support.microsoft.com/profile=BCCF7416-DA4E-4D73-83E2-65FD61BAB16D Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it! Read More...
|
-
<Denis Gobo’s mode on> Suppose you have an empty table: SELECT COUNT (*) FROM SampleTable --- 0 What would be the result of the following query: DBCC CHECKIDENT ( 'SampleTable' , RESEED , 1 ) INSERT SampleTable ( j ) SELECT 1 SELECT SCOPE_IDENTITY Read More...
|
-
When you run NUnit/C# unit tests against your local instance, you are a dbo. As such, you are not getting any errors caused by missing permissions. However, you can impersonate another user, and run your unit tests in the context of that other user. The Read More...
|
|
|
|
|
|