Database

Quick Search

Transact-SQL: Renaming a Column

July 13th, 2010 by admin
No comments »

To rename a column, first open an empty query window. In a query window, execute sp_rename using the following formula:

sp_rename ‘TableName.ColumnName’, ‘NewColumnName’, ‘COLUMN’

The sp_rename factor and the ‘COLUMN’ string are required. The TableName factor is the name of the table that the column belongs to. The ColumnName is the current … Read More

Transact-SQL: Deleting a Column

July 13th, 2010 by admin
1 comment »

To delete a column using code, first open or access an empty query window, and use the following syntax:

ALTER TABLE TableName
DROP COLUMN ColumnName

On the right side of the ALTER TABLE expression, type the name of the table. On the right side of the DROP COLUMN expression, enter the name of … Read More

An Identity Column

July 13th, 2010 by admin
No comments »

An identity column is one whose value is automatically created by the database engine when a new record is added. This makes sure that each record has a unique value for that field.

To create an identity column in Transact-SQL, after the name and data type of the column, type identity … Read More

Transact-SQL: Adding a Column to a Table

July 13th, 2010 by admin
No comments »

 

To add a new column to a table, follow this syntax:

ALTER TABLE TableName
ADD ColumnName Properties

Here is an example:

ALTER TABLE Members
ADD Address varchar(100) NULL
GO

When above code is executed, a new column named Address, of type varchar, with a limit of 100 characters, and that allows empty entries, would be added to the … Read More

SQL Expressions/Examples

June 29th, 2010 by admin
2 comments »

Creating a Database

To create a database in SQL, use the following syntax:

CREATE DATABASE DatabaseName

Here is an example:

CREATE DATABASE BethesdaCarRental;
Deleting a Database

To delete a database, you use the DROP DATABASE expression followed by the name of the database. The formula used is:

DROP DATABASE DatabaseName;

Here is an example:

DROP DATABASE RealEstate1;
GO

Renaming a Database

To … Read More

SEO Company India

search engine marketing company India that offers affordable seo services