Wednesday, March 30, 2011

MySQL Error 1050 table already exists error

In MySQL when running on a Windows server with "Make table names case insensitive" set to 2. You will get a table exists error when trying to create a table that has previously been created. I have found that this occurs if you use upper case letters in the name of the table. For example: Create Table JohnTempTable (ud1 int, ud2 varchar(10)); Drop Table JohnTempTable; Now when you try and create the same table you get a table exists error. The work around I found is to create your original table using all lower case. example: Create Table johntemptable (ud1 int, ud2 varchar(10)); Now you can drop and recreate the table without the table exists error.

Friday, March 4, 2011

Using NOLOCK in sql select statements

It may not be necessary to use NOLOCK after the from clause in your scripts. Microsoft has put out some info on the use of NOLOCK and I have come to the conclusion that using NOLOCK should be the exception to the rule and not the rule. Here is a link that explains.

http://blogs.msdn.com/b/sqlcat/archive/2007/02/01/previously-committed-rows-might-be-missed-if-nolock-hint-is-used.aspx

Enjoy the article its quite long.

Thanks