先做事后做人

博客园 首页 新随笔 联系 订阅 管理

Transact-SQL overview   Author:Rob Taylor

Transact-SQL    Author:Rob Taylor

What is Transact-SQL?
Transact-SQL,also called T-SQL,is Microsoft's exension to the ANSI SQL language.It is the driving force of Microsoft's SQL Server and is a dynamic database programming language.There have been several extensions added to the ANSI SQL language that have become their own SQL language.Oracle PL/SQL is another.So if you were using a Oracle database,you would do data programming in PL/SQL.Just like you used T-SQL with SQL Server.

How is T-SQL Used?

T-SQL is written inside of a stored procedure.A sotre procedure is a store set of SQL commands that sit on the physical server.In this case the SQL Server.They are comiled after the first use and take heavy burden off the server.Often with ASP  development you run into a situations where interaction between the database and the application are rapidly succession.

Why T-SQL?
You write satic SQL in you ASP page,it's "static".With T-SQL you can built you queries to get high amount of resue out you project.

Example:
CREATE PROCEDURE SP_Products
@cat int,
@Price nvarchar(10)
 AS

Select CODE,TITLE,Version,Status,

Case @Price
    When 'Price' THEN Price
    When 'PriceA' Then PriceA
    When 'PriceB' Then PriceB
    When 'PriceC' Then PriceC
End,
  Lots,
  LotsOf,
  Description,
  Pic
From Products
Where Category = @cat ORDER BY CODE

 

 

posted on 2006-03-15 14:24  asdfasdf  阅读(237)  评论(0)    收藏  举报