SQL Queries: Capturing changes to DB, Analyzing the changes

Backing up default tables: Select * Into USERS_Backup from USERS (6 row(s) affected) Duplicating Rows: INSERT into [USERS] SELECT * from [USERS] where [USERNAME] = ‘DEMO’ Msg 2601, Level 14, State 1, Line 1 Cannot insert duplicate key row in object ‘dbo.USERS’ with unique index ‘USRRECID’. The duplicate key value is (PQ$&3-#5U1). The statement has been terminated. Modifying existing rows: UPDATE [MYDB].[dbo].[USERS] SET [USERNAME] = ‘DEMO’, [NAME] = ‘DEMO’ WHERE USERNAME = ‘NEWDEMO’ GO Creating new users: SET ansi_warnings OFF INSERT INTO [USERS] VALUES (‘TESTUSR1′,’TESTUSR1′,NULL,NULL,NULL,NULL,NULL,NULL,’0_’,’encryptedpasswordstringhere’,NULL,’TESTUSR1′,’2011-12-16 00:00:00.000′,’13:23′,NULL,”,’new-recid’) Compare two tables having identical layout: SQL Query: SELECT * FROM CONTACT1 WHERE NOT […]

Read more

The database ‘%.*ls’ cannot be opened because it is version %d. This server supports version %d and earlier. A downgrade path is not supported.

Details Product: SQL Server ID: 948 Source: MSSQLServer Version: 10.0 Component: SQLEngine Message: The database ‘%.*ls’ cannot be opened because it is version %d. This server supports version %d and earlier. A downgrade path is not supported. Explanation Certain features in SQL Server affect the structure of the database files. When you attach a database to another instance of SQL Server, the file format might not be compatible with a different version of the Database Engine. For example, this error can be caused by using the vardecimal storage format in a later version of SQL Server and then trying to […]

Read more