Changing the Size of Column :
You can change the Length, Precision or Scale of a column by specifying a new size for the column datatype in the ALTER COLUMN Clause.
If Data Exist in the column , the new size can not be smaller than the maximum size of the data. Also the column can not be defined in an Index, Unless the column is a varchar, nvarchar or varbinary data type and the Index is not the result of a PRIMARY Key constraint.
Syntax :
ALTER table <table> alter column <coumn> nvarchar(biggernumber) [NOT] NULL
Example :
Use Val_Invoice_Data
GO
ALTER table [tblvaluation] alter column valuationtype varchar(MAX)
You can change the Length, Precision or Scale of a column by specifying a new size for the column datatype in the ALTER COLUMN Clause.
If Data Exist in the column , the new size can not be smaller than the maximum size of the data. Also the column can not be defined in an Index, Unless the column is a varchar, nvarchar or varbinary data type and the Index is not the result of a PRIMARY Key constraint.
Syntax :
ALTER table <table> alter column <coumn> nvarchar(biggernumber) [NOT] NULL
Example :
Use Val_Invoice_Data
GO
ALTER table [tblvaluation] alter column valuationtype varchar(MAX)
Alter table(table name); In this syntax we need to add a data type of column.?
ReplyDeleteHow to delete a colum.?
Hello,
DeleteSyntax for delete a column from a table :
alter table [tablename] drop column [CoulmnName]
Thanks,
Sachin