易截截图软件、单文件、免安装、纯绿色、仅160KB

生成表中数据的sql语法的存储过程

      一般用BCP在处理这个事情,但有时也需要一些特殊的处理,以下是生成表中的一些数据,带有where条件的选择生成数据,是我一个同事修改的,直接拿过来用了:
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
Create Proc proc_insert_where (@tablename varchar(256),@where varchar(256))
as -- 表名称
begin
Declare @sqlstr varchar(8000),
@sqlstr1 varchar(8000),
@sqlstr2 varchar(8000),@col varchar(1000),@colid int,@name varchar(20)
Select @sqlstr='select ''Insert '+@tablename
Select @sqlstr1= ' Values ( ''+', @sqlstr2=' ('
--print '5'
select @where = isnull(@where,'')
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+','''''''','''''''''''')' + '+'''''''''+' end'
when a.xtype =108 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar('+convert(varchar(4),a.xprec+2)+'),'+a.name +')'+' end'
when a.xtype =231 the


相关文档:

一个programmer关于Oracle SQL的学习小结与思考

http://www.javaeye.com/topic/366991#
作为一个开发人员,开始认真系统学习
Oracle SQL也只有月余,之前的
SQL知
识仅仅是项目里面用到什么就去看什么,简单说就是
Read The Fxxking Guide。在系统学习
Oracle
SQL之前,俺的想法就是“按照需求完成功能,剩下的交给
DBA来处理”。这个想法从整体来看显 ......

经典SQL语句大全

一、基础
1、说明:创建数据库
CREATE DATABASE database-name
2、说明:删除数据库
drop database dbname
3、说明:备份sql server
--- 创建 备份数据的 device
USE master
EXEC sp_addumpdevice 'disk', 'testBack', 'c:\mssql7backup\MyNwind_1.dat'
--- 开始 备份
BACKUP DATABASE pubs TO testBack
4、说 ......

oracle sql loader


SQL*LOADER是ORACLE的数据加载工具,通常用来将操作系统文件迁移到ORACLE数据库中。SQL*LOADER是大型数据
仓库选择使用的加载方法。
  在NT下,SQL*LOADER的命令为SQLLDR,在UNIX下一般为sqlldr/sqlload。
  如执行:d:\oracle>sqlldr
SQL*Loader: Release 8.1.6.0.0 - Production on 星期二 1月 8 11:06:42 2 ......

sql数据导入导出

大家打开这个链接可以看到很多数据库的连接方法。http://www.connectionstrings.com
这些数据库之间的数据交换就是这个贴子所要总结的内容。
(一)SQL Server之间
把远程数据库中的数据导入到本地数据库。
http://community.csdn.net/Expert/topic/5079/5079649.xml?temp=.7512018
http://community.csdn.net/Expert/ ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号