SOME USEFUL QUERIES

How to rename a column in a table
Exec sp_rename
@objname='tablename.oldcolumnname'
@newname='newcolumnname'
@objtype='COLUMN'




Adding Default value to column
Alter table tableName Add Constraint ContraintName Default(Value) For ColumnName

Adding Identity Constraint
Alter table tableName Add Constraint ContraintName Identity(Increment Value) For ColumnName

BackUp Database
Alter Database DBName Set Recovery FULL

Backup Database DBName To DISK='Path'
With Format

Alter column property
Alter Table DBName Alter Column ColName datatype

Add column to table
Alter Table DBName Add Col1 datatype,Col2 datatype

No comments:

Post a Comment

Pages