SQL 中将一个表转化成建表语句的存储过程
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE proc pGetInsertSQL (@TableName varchar(256))
as
begin
set nocount on
declare @sqlstr varchar(4000)
declare @sqlstr1 varchar(4000)
declare @sqlstr2 varchar(4000)
select @sqlstr='select ''insert '+@tablename
select @sqlstr1=''
select @sqlstr2=' ('
select @sqlstr1= ' values ( ''+'
select @sqlstr1=@sqlstr1+col+'+'',''+' ,@sqlstr2=@sqlstr2+name +',' from (select case
-- when a.xtype =173 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar('+convert(varchar(4),a.length*2+2)+'),'+a.name +')'+' end'
when a.xtype =104 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(1),'+a.name +')'+' end'
when a.xtype =175 then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'replace('+a.name+','''''''','''''''''''')' + '+'''''''''+' end'
when a.xtype =61 then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'convert(varchar(23),'+a.name +',121)'+ '+'''''''''+' end'
when a.xtype =106 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar('+convert(varchar(4),a.xprec+2)+'),'+a.name +')'+' end'
when a.xtype =62 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(23),'+a.name +',2)'+' end'
when a.xtype =56 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(11),'+a.name +')'+' end'
when a.xtype =60 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(22),'+a.name +')'+' end'
when a.xtype =239 then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'replace('+a.name+','''
相关文档:
“经过测试我们发现SQL Server 2008当中的备份压缩功能可以1-3倍的压缩比,从而极大的减少备份所需的磁盘空间。”Alexey Yeltsov, 微软系统管理员主管。
微软在全世界共有6万多名员工,在2006年的财政收入超过了500亿美金,与此同时也产生了大量内部数据,公司希望对这些数据进行集中以便提供客户的集成化视图。 ......
数据库备份实例/**
**数据库备份实例
**朱二 2004年5月
**备份策略:
**数据库名:test
**备份文件的路径e:\backup
**每个星期天凌晨1点做一次完全备份,为保险起见,备份到两个同样的完全备份文件test_full_A.bak和test_full_B.bak
**每天1点(除了星期天)做一次差异备份,分别备份到两个文件test_df_A.bak和test_df ......
如何修改SQL Server的连接数
我把SQL Server 7.0的用户连接数设为1后,数据库就再也连不上了,所以也没办法修改连接数
请问有什么办法能修改连接数?
在server 的属性里面有个connetctions 的
maximun concurr ......
select top 每页显示的记录数 * from topic where id not in (select top (当前的页数-1)×每页显示的记录数 id from topic order by id desc) order by id desc
select top 每页显示的记录数 * from topic where id not in (select top (当前的页数-1)×每页显示的记录数 id from topic order by id desc) ......
如要在一个hwsp表中填加字段:ylxs
alter table hwsp add column ylxs
ALTER TABLE 表 {ADD ADD{COLUMN 字段类型 [ (字长)] [NOT NULL] [CONSTRAINT 索引 ] |
ALTER COLUMN 字段类型 [(字长)] |
CONSTRAINT 多重字段索引 } |
&nbs ......