SQL SERVER – 2005 – Explanation and Script for Online Index Operations – Create, Rebuild, Drop

SQL Server 2005 Enterprise Edition supports online index operations. Index operations are creating, rebuilding and dropping indexes. The question which I receive quite often – what is online operation? Is online operation is related to web, internet or local network? Online operation means when online operations are happening the database…
Read More

SQL SERVER – 2005 – Difference and Similarity Between NEWSEQUENTIALID() and NEWID()

NEWSEQUENTIALID() and NEWID() both generates the GUID of datatype of uniqueidentifier. NEWID() generates the GUID in random order whereas NEWSEQUENTIALID() generates the GUID in sequential order. Let us see example first demonstrating both of the function. USE AdventureWorks; GO ----Create Test Table for with default columns values CREATE TABLE TestTable…
Read More

SQL SERVER – Insert Data From One Table to Another Table – INSERT INTO SELECT – SELECT INTO TABLE

Following three questions are many times asked on this blog. How to insert data from one table to another table efficiently? How to insert data from one table using where condition to another table? How can I stop using cursor to move data from one table to another table? There…
Read More

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.

Following error is encountered when view is attempted to created with ORDER BY clause in it. ORDER BY clause is not allowed in views in SQL Server 2005. This solution also displays the workaround to use ORDER BY in VIEW. I really do not prefer to use views. My views…
Read More