Powered by Blogger.

Saturday, February 15, 2014

Modify table structure in GUI in Sql Server 2008

In this post we will discuss about how to modify table structure in GUI in sql server 2008. Also you can check out my previous posts on:

- Get weekday name in sql server 2008

- Serialization and Deserialization in Remoting in C#.Net

- How to find the difference in retrieving data with and without using index in sql server 2008?

To modify the table structure in GUI with in Object Explorer follow the below steps.

- Right click on the table and chose "Design", that opens design of the table.

- To change the datatype of a column directly click on the datatype of the column you want to modify, then modify the datatype.

- To add or remove the not null constraint use Allow Nulls check box provided with each column.

- To add a column to the table at the end of existing columns in the table you will have an empty column to specify column name, datatype and whether or not to allow nulls.

- To add constraints in the table follow the same procedure as adding constraints to the table while creating the table in GUI.

- To delete primary key constraint right click on primary key column and choose remove primary key.

- To delete the default constraint, click on the column on which you want to delete the default constraint. Go to column properties and remove the default value specified for the column at the property default value or binding.

- To delete unique, check constraint and foreign key constraint right click on table and open the corresponding dialog box where you will have the button ‘remove’ to delete the constraint.

- To delete a column, select the entire column by clicking on the button available on left of the column and then press delete button on keyboard.

After making all required changes to the structure of the table, click on the save button in the tool box to applying changes to the table and then close the dialog box.