Msg 2540 means the system cannot self repair this error, usually corrupt metadata or system files. My fix order: restore the backup, DBCC repair, check hardware.
SQL SERVER – 2005 – Use of Non-deterministic Function in UDF – Find Day Difference Between Any Date and Today
I always thought a non-deterministic function was not allowed in a UDF, but GETDATE() works in SQL Server 2005. My UDF finds the day difference from today.
Writing Clear Error Messages in Procedures
Clear error messages in procedures identify the failed operation, useful keys, and next action without exposing sensitive data.
SQL SERVER – 2005 – Difference and Similarity Between NEWSEQUENTIALID() and NEWID()
NEWSEQUENTIALID() and NEWID() both create a uniqueidentifier GUID. NEWID() is random while NEWSEQUENTIALID() is sequential, as my test table shows.
SQL SERVER – Fix : ERROR : Msg 1033, Level 15, State 1 The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP or FOR XML is also specified.
Msg 1033: the ORDER BY clause is invalid in views unless TOP or FOR XML is used. My workaround moves ORDER BY to the SELECT that calls the view.
SQL SERVER – Fix: Error 2596 The repair statement was not processed. The database cannot be in read-only mode
Error 2596 stops a DBCC repair because the database is read only. Here is the safe order: back up, single user, read write, repair and check again.
SQL SERVER – FIX : Error 945 Database cannot be opened due to inaccessible files or insufficient memory or disk space. See the SQL Server error log for details
Error 945 means the database cannot be opened due to inaccessible files or low disk space. My four checks: disk space, autogrow, permissions and read only files.







