Alter Column - Default Value
Hello,
I am trying to alter a table , in this task i need to alter some columns in order to set the default value to -1 or 1 , I tried the following methodology and it never worked , please help me to get the syntax right.
if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[TestEnvironment]') and OBJECTPROPERTY(id, N'IsUserTable')
= 1)
begin
ALTER TABLE [TestEnvironment] alter column [Name] varchar(100) not null
ALTER TABLE [TestEnvironment] alter column [Other] varchar(500) not null
ALTER TABLE [TestEnvironment] alter column [SerMinNumProcs]
smallint not null DEFAULT 1
ALTER TABLE [TestEnvironment] alter column [SerRAMID] SET DEFAULT -1 int
not null
ALTER TABLE [TestEnvironment] alter column [SerHDID] int not
null DEFAULT -1
ALTER TABLE [TestEnvironment] alter column [CliMinNumProcs] smallint not null DEFAULT 1
ALTER TABLE [TestEnvironment] alter column [CliRAMID] int
not null DEFAULT -1
ALTER TABLE [TestEnvironment] alter column [CliHDID] int
not null DEFAULT -1
end
GO
thanking you
regards
Sasidhar
thanks,
Sasidhar
__________________
thanks,
Sasidhar
|