用SQL语句断开某个数据库的所有活动连接
use master
go
if exists(select * from dbo.sysobjects where id = object_id(N'[dbo].[P_KillConnections]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[P_KillConnections]
GO
create proc P_KillConnections
@dbname varchar(200)
as
declare @sql nvarchar(500)
declare @spid nvarchar(20)
declare #tb cursor for
select spid=cast(spid as varchar(20)) from master..sysprocesses where dbid=db_id(@dbname)
open #tb
fetch next from #tb into @spid
while @@fetch_status=0
begin
exec('kill '+@spid)
fetch next from #tb into @spid
end
close #tb
deallocate #tb
go
--Usage
exec P_KillConnections 'DB'
相关文档:
想使用PL/SQL开发工具,但不想安装那个几百兆的oracle客户端,于是安装了oracle 10g inistant client,40多M吧。
安装后PL/SQL可以用了,但是查询出记录里面的中文却是乱码。折腾了好久才找出解决方法:
设置环境变量:NLS_LANG,值为Oracle数据库设置的字符集,在我的系统里面设置是:SIMPLIFIED CHINESE_CHINA.ZHS16GBK ......
create table Student(Sname varchar(10),Ssex varchar(5),Sage int,S# int)
insert into Student
select '夏亮','男','21','1004'
select '成平','男','20','1001' union all
select '王波','男','19','1002' union all
select '突然','女','19','1003'
create table Course(C# varchar(10),Cname v ......
DDL:数据库定义语言(create ,alter,modify)可自动提交。
DML:数据库操作语言(insert, update,alter)应设SET AUTOCOMMIT ON
DCL:数据库控制语言(grant,deny,revoke)
create table table_name (column_name type [not null] [constraint constraint_definition default XXXXXX] )
[primary key (column_name,col ......
最近处理excel数据导入到Sql Server中,失败,报错如下
:
作
为源列3(“产品说明”)的数据对于所指定的缓冲区来讲太大
。
我的excel文件中有一列叫“产品说明”,就是一些
文字。Sql
server处理导excel数据流程是这样的,它会先创建目标表,再把excel数据写入缓冲区,然后再把缓冲区数 ......