Sunday, February 6, 2011

Writing Transact-SQL (Part 1)

In this tutorial serious show you how to create a database,create a table , insert data,update data,read data delete data and then delete the table. And also you will learn to create views and stored procedures and configure a user to the database and the data.

T-SQL statements can be written and submitted to the Database Engine in the following ways.
  • By using SQL Server Management Studio
  • By using the sqlcmd utility
  • By connecting form an application that you create
To Create a database

You can use the following query to create the database.













Switch the query Editor connection to the TestDatabase database.

For the you can use following query.

USE TestDatabase
GO


Create a table
You can use following query to create a simple table named Products. The Products table consists of 4 columns. The ProductID column is the primary key of the table. This query contains an optional element (dbo.) called a schema. The schema is the database object that owns the table. If you are an administrator , dbo is the default schema. dbo stands for database owner.

No comments:

Post a Comment