create procedure pp456
AS
create table #tb
(
ID INT,
NAME VARCHAR(50),
SAL MONEY,
TA MONEY,
ROW INT
)
DECLARE @id int,@name varchar(50),@sal money,@c cursor
BEGIN
set nocount on
set @c=cursor for select ID,NAME,SAL FROM B
open @c
fetch next from @c into @id,@name,@sal
while @@fetch_status=0
begin
insert into #tb values(@id,@name,@sal,(@sal*.1),@@CURSOR_ROWS)
fetch next from @c into @id,@name,@sal
end
CLOSE @C
DEALLOCATE @C
select * from #tb
drop table #tb
set nocount off
END
EXECUTE OF THE PROCEDURE
exec pp456
No comments:
Post a Comment