I am trying to modify a table on a SQL server using a script. I used to always do this through the GUI, but now I need to create a script to do this for clients.
I have a SQL Server database table that looks like this:
Mytable
-------
ColA int NOT NULL
ColB int NOT NULL
ColC int NOT NULL
ColD VARCHAR (100)
The primary key is determined through ColA, ColB and ColC.
I want the SQL script to change the table as follows:
Mytable
-------
ColA int NOT NULL
ColB int NOT NULL
ColX int NOT NULL (new column, default 0 for existing data)
ColC int NOT NULL
ColD VARCHAR (100)
The primary key will now be determined by ColA, ColB, ColX and ColC.
SQL Server. script, . , script , , temp, , , :
ALTER TABLE dbo.Tmp_MyTable ADD CONSTRAINT
MyTable21792984_ColC_DF DEFAULT ((0)) FOR ColC
, ( 21792984) . , SQL- , .
SQL? , , , / .
. , , , " ". , , ( , , ). , , .