Syntax:
ALTER TABLE {TABLENAME}
ADD {COLUMNNAME} {TYPE} {NULL|NOT NULL}
CONSTRAINT {CONSTRAINT_NAME} DEFAULT {DEFAULT_VALUE}
WITH VALUES
Example:
ALTER TABLE SomeTable
ADD SomeCol Bit NULL --Or NOT NULL.
CONSTRAINT D_SomeTable_SomeCol --When Omitted a Default-Constraint Name is autogenerated.
DEFAULT (0)--Optional Default-Constraint.
WITH VALUES --Add if Column is Nullable and you want the Default Value for Existing Records.
Notes:
Optional Constraint Name:
If you leave out CONSTRAINT D_SomeTable_SomeCol
then SQL Server will autogenerate
a Default-Contraint with a funny Name like: DF__SomeTa__SomeC__4FB7FEF6
Optional With-Values Statement:
The WITH VALUES
is only needed when your Column is Nullable
and you want the Default Value used for Existing Records.
If your Column is NOT NULL
, then it will automatically use the Default Value
for all Existing Records, whether you specify WITH VALUES
or not.
How Inserts work with a Default-Constraint:
If you insert a Record into SomeTable
and do not Specify SomeCol
's value, then it will Default to 0
.
If you insert a Record and Specify SomeCol
's value as NULL
(and your column allows nulls),
then the Default-Constraint will not be used and NULL
will be inserted as the Value.
Notes were based on everyone's great feedback below.
Special Thanks to:
@Yatrix, @WalterStabosz, @YahooSerious, and @StackMan for their Comments.
A colleague found this MS auto-uninstall tool which has successfully uninstalled VS2008 for me and saved me hours of work!!
Hopefully this might be useful to others. Doesn't speak highly of MS's faith in their usual VS maintenance tools that they have to provide this as well!
Best Answer
The visual studio that you get is a shell called Business Intelligence Development studio and it allows you to create Analysis Services, Integration Services, and Reporting Services projects. Also it allows you to deploy those projects to your SQL Server. If you already have Visual Studio installed, it will add those project types to it.
With the Development Studio you can add .Net projects such as C# or VB to your Analysis Services or Reporting Services projects to create custom components for them. There are additional benefits, but you should just do a search for Business Intelligence Development Studio to see what else can be done.
EDIT:
I just noticed that you were asking about what happens if you uninstall Visual Studio 2008. There should be a listing under your installed Programs called Visual Studio Shell or something of that nature, which is the Business Intelligence Development Studio and is independent of the main Visual Studio 2008 install. Both of them will allow you to create the Ms SQl Projects that I listed above. When you uninstall Visual Studio 2008 it won't uninstall this application and vice verse. If you do accidentally delete it, you can always install it again using your MS SQL CDs. There are instructions on the web to do so.