备份成功,还原时出现未能找到存储过程kill51的错误.'关闭用户进程,防止其他用户正在使用数据库,导致数据还原失败
SqlStr = "Select spid from master..sysprocesses where dbid=db_id('" & sDataBaseName & "')"
rs.Open SqlStr, cn, adOpenKeyset, adLockReadOnly
While rs.EOF = False
  SqlStr = "kill" & rs(0)
  cn.Execute SqlStr
  rs.MoveNext
Wend
rs.Close我想是sql server中没有这个存储过程,便找来一个.use     master     
  go   
  create     proc     killspid     (@dbname     varchar(20))       
  as       
  begin       
  declare     @sql     nvarchar(500),@temp   varchar(1000)   
  declare     @spid     int       
  set     @sql='declare     getspid     cursor     for           
  select     spid     from     sysprocesses     where     dbid=db_id('''+@dbname+''')'       
  exec     (@sql)       
  open     getspid       
  fetch     next     from     getspid     into     @spid       
  while     @@fetch_status   =0   
  begin       
      set   @temp='kill     '+rtrim(@spid)   
      exec(@temp)   
  fetch     next     from     getspid     into     @spid       
  end       
  close     getspid       
  deallocate     getspid       
  end    可是结果仍然提示未能找个存储过程kill51,请高手指教!
完整程序代码请参看:http://topic.csdn.net/u/20080605/16/43a6a333-ea06-4b64-a396-7b7fef2b7e9a.html.