c#动态创建存储过程中,提示go 附近有语法错误解决方案
2010-09-30 22:45:55 来源:WEB开发网但执行过程中出现以下错误
以下是我在查询分析器中能正常使用的脚本代码。
1 USE [RadarDataBase]
2 GO
3 SET ANSI_NULLS ON
4 GO
5 SET QUOTED_IDENTIFIER ON
6 GO
7 create proc [dbo].[P_KillConnections]
8 @dbname varchar(200)
9 as
10 declare @sql nvarchar(500)
11 declare @spid nvarchar(20)
12 declare #tb cursor for
13 select spid=cast(spid as varchar(20)) from master..sysprocesses where dbid=db_id(@dbname)
14 open #tb
15 fetch next from #tb into @spid
16 while @@fetch_status=0
17 begin
18 exec('kill '+@spid)
19 fetch next from #tb into @spid
20 end close #tb deallocate #tb ";
更多精彩
赞助商链接