How Can Drop a Particular Column in a Table

alter table tbnew drop column eadd

–Now Check the Table Columns

exec sp_help tbnew

———————————-

truncate table tbnew

–how Can Apply Parimary Key on a Existing Table

create table tb55(empno int not null,ename varchar(40))

——-Apply Constraints on a Table

alter table tb55 add constraint pk_name primary key(empno)

–See Constraint Has applied

exec sp_helpconstraint tb55

——————————————

alter table tb55 add constraint My_uniquename unique(ename)

–How can View All constraints of All Tables which are Available in Your Database

select OBJECT_NAME(object_id) as Name,OBJECT_NAME(parent_object_id)as Tb,Type_desc from sys.objects where type_desc like ‘%constraint’

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s