alter proc getName
@userName varchar(50)
as
if(@userName = 'xsm') begin
select userName from Table_Test where userName=@userName;
end
else begin
select count(*) from Table_Test;
end
return
alter proc getWeek
@weeks varchar(50)
as
declare @i int, @weekName varchar(50)
set @i=0
set @weekName='Sunday'
select @weeks=
case
when @weeks = '0' then 'Monday'
when @weeks = '1' then 'Firthday'
when @weeks = '2' then 'Wenday'
when @weeks = '3' then 'Thirday'
when @weeks = '4' then 'Friday'
when @weeks = '5' then 'Staterday'
else @weekName
end
print @weeks
alter proc getCurTable_Test
@userName varchar(50)
as
declare my_cursor cursor for select userName,passWord from Table_Test
declare @u varchar(50),@p varchar(50)
open my_cursor
fetch next from my_cursor into @u, @p
while(@@fetch_status=0)
begin
print @u + @p
fetch next from my_cursor into @u, @p
end
--fetch first from my_cursor into @u, @p
close my_cursor
deallocate my_cursor
select userName,passWord from Table_Test
exec getName 'xsddm'
exec getWeek '0'
exec getCurTable_Test ''