Monday, January 24, 2011

Recovering the mirror DB when Principal DB fails in sql server

When principal db is non-operational and fully inaccessible then following commnd needs to run on mirror DB to recover it.


Wednesday, January 5, 2011

How to set Identit Seed to all tables that have auto Increment Primarykey and seeds set to 1

In SQL Replication if we disconnect the replication between subscriber DB and publisher DB and then want to make subscriber DB as our primary Database on production server , then we face a common problem regarding the auto increment primary key because its seed set to 1 and that causes a duplicate records problem , here is the script to set seed to the maxim value.

please find the attachment for script. Click here to downlaod

How to Find all triggers in sql server along with table to which triggers are applied

Here is the way to find out all the triggers in sql server tables along with table to which it applies.

SELECT  NAME AS TriggerName,OBJECT_NAME(parent_obj) AS TableName FROM sysobjects WHERE xtype='TR'