TSQL/ PLSQL in Sql Server:
- It is a SQL Programming language used in SQL Server.
- TSQL programs are called "TSQL Block"
- TSQL blocks are
- 1. Anonymous blocks : Executed within session scope
- 2. Named Blocks: Its is a named block executed anytime from anywhere.
Ex:- write a program to input an employee number and check the employee commission.If the commission is null update the the commission to RS. 500, otherwise increment the commission by Rs.200.
declare @eno int,@commission int
set @eno=114
select @commission=commission from employ where eid=@eno
print @commission
if @commission is NULL
update employ set commission=500 where eid=@eno
else
update employ set commission=commission+200 where eid=@eno
Comments
Post a Comment