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 – UDF – Validate Integer Function
ISNUMERIC() returns 1 for plus, minus and currency signs, so it is not a safe check. I share the UDF I use to validate integer values instead.
SQL SERVER – 2005 – Find Stored Procedure Create Date and Modified Date
A simple script on sys.objects that shows the stored procedure create date and modified date, handy for audits and for watching changes to your objects.
SQL SERVER – 2005 – List All The Column With Specific Data Types
A handy script to list all columns with specific data types in a database. We used it to find TEXT columns and change them to VARCHAR(MAX) in SQL Server 2005.
SQL SERVER – 2005 – List Tables in Database Without Primary Key
A simple script to list tables in database without primary key, using sys.tables and OBJECTPROPERTY TableHasPrimaryKey in SQL Server 2005.
SQL SERVER – Stop SQL Server Immediately Using T-SQL
Need to stop SQL Server immediately? Run SHUTDOWN, or SHUTDOWN WITH NOWAIT to skip checkpoints. I also note which roles have permission to run it.







