top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What Is Transact-SQL Language?

+2 votes
633 views
What Is Transact-SQL Language?
posted Feb 2, 2014 by Mona Sharma

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

0 votes

Transact-SQL (T-SQL) is Microsoft's and Sybase's proprietary extension to SQL. SQL, often expanded to Structured Query Language, is a standardized computer language that was originally developed by IBM for querying, altering and defining relational databases, using declarative statements. T-SQL expands on the SQL standard to include procedural programming, local variables, various support functions for string processing, date processing, mathematics, etc. and changes to the DELETE and UPDATE statements. These additional features make Transact-SQL Turing complete.

Static SQL, like you write in your ASP pages, has several drawbacks. The biggest being that it is static. With TSQL you can build your queries to get a high amount of reuse out your objects. Much like you would use IF statements and Select CASE statements in ASP program, you can do the same with T-SQL. The following is an example of a TSQL statement that selects a different field in the SQL Server Database based on the parameters passed to the Stored Procedure (Stored Proc).

    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

In the above example I am selecting a different Price field based on the user level of the buyer. Some additional benefits:
Faster Processing.
Maintainability.
Security.
The Editor Itself.: Editing stored procedures on the SQL server is also far more practical and user friendly than opening ASP files and re-writing static SQL. The SQL server also checks your syntax and will not let you write an invalid query. You do not have to keep hitting the refresh button in the browser until everything checks out.

answer Feb 2, 2014 by Amit Kumar Pandey
0 votes

Acc. to WIKI & Stack Ans :


Transact-SQL => is a proprietary procedure language used by MS and Sybase with SQL. T-SQL basically extends the features of SQL by adding some programming extension like : local variable,string processing,error and exception handling. They are also used to write stored procedures.

T-SQL consist of keywords for flow and condition :

IF-ELSE,BEGIN,BEGIN,END,CONTINUE,BREAK,WHILE and so on.

answer Aug 16, 2014 by anonymous
...