存储过程的种类:   
    1.系统存储过程。        以sp_开头  
    2.扩展存储过程。        以xp_开头  
    3.用户定义存储过程。

--重新编译存储过程
exec sp_recompile user_procedure 
--执行存储过程
exec sp_recompile user_procedure
--执行存储过程,并给定参数 
exec user_procedure '参数1','参数2'    
--删除存储过程  
drop procedure user_procedure  
--查看存储过程源代码  
exec sp_helptext user_procedure
--建立存储过程
create procedure user_procedure  
--修改存储过程    
alter procedure user_procedure

SQL 循环

declare @id int	
declare @user_name nvarchar(30)	
declare @group_id int

declare user_cur cursor for select * from dbo.dt_user  
open user_cur 
fetch user_cur into @id,@user_name,@group_id
while @@fetch_status=0 
begin   
	--print @id
	update dt_user set group_id=@id where id=@id
	fetch user_cur into @id,@user_name,@group_id	 
end
close user_cur
deallocate user_cur

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-20
  • 2021-11-01
  • 2021-12-20
  • 2022-01-31
  • 2021-12-26
  • 2021-12-29
猜你喜欢
  • 2021-08-02
  • 2022-12-23
  • 2021-09-19
  • 2021-10-10
  • 2022-03-03
  • 2021-10-20
  • 2022-12-23
相关资源
相似解决方案