方法1: SELECT * FROM [Master].[dbo].[SYSPROCESSES] WHERE [DBID] IN ( SELECT [DBID] FROM [Master].[dbo].[SYSDATABASES] WHERE NAME='OIW21017') 方法2: select * from [Master].[dbo].[SYSPROCESSES] where dbid = db_id('OIW12858') 断开会话: 语法:kill spid号 kill 82…
SQLServer判断指定列的默认值是否存在,并修改默认值 2008年10月21日 星期二 下午 12:08 if exists(select A.name as DefaultName,B.name as TableName from sysobjects A inner join sysobjects B on A.parent_obj = B.id where A.xtype = 'D' and B.xtype = 'U' and B.name = 'test') --在SQLserver…
用标准sql的with实现递归查询(sql2005以上肯定支持,sql2000不清楚是否支持): with subqry(id,name,pid) as ( select id,name,pid from test1 where id = 5 --指定id union all select test1.id,test1.name,test1.pid from test1,subqry where test1.pid = subqry.id)select* from subqry;…