Sunday, December 1, 2013

How to create, alter and Drop a Constraints in SQL SERVER

To alter a constraints we need to drop that constraints first.
then recreate that constraints.

Follow this syntax, to Drop Constraints.

ALTER TABLE [dbo].[TableName]  DROP CONSTRAINT [FK_Config_ConstraintsName]

How to check a constraint is exist or not ?


REFERENTIAL constraints are saved in REFERENTIAL_CONSTRAINTS table.

SELECT
    *
    FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS

    WHERE CONSTRAINT_NAME   ='FK_EVENT_CONFIGURATION_SCREEN_MASTER'

SQL Optimization

  SQL Optimization  1. Add where on your query  2. If you remove some data after the data return then remove the remove condition in the sel...