文章分类 | 推荐文章 | 最新文章 | 热点文章 | 最新软件 | 精品软件 | 下载排行 | 推荐下载 | 免费看大片 | WPS | 杀毒软件
清风网络
首 页 软件下载 网络学院 数码学院
QQ 电脑入门 游戏 操作系统 图形处理 办公软件 媒体动画 精文荟萃 工具软件 网络编程 程序开发 网络技术 认证考试 网站建设 文章专栏
当前位置:清风网络学院网络编程MSSQL把SQL SERVER里表里的数据导出成为insert into 脚本
精品推荐
特别推荐
·SQL Server企业管理器和查询分析器简介
·常用SQL语句词典
·结束SQL注入隐患3招
·掌握SQL Server数据库的实用技巧
·SQL的简单查询
·快速解决SQL Server“安全疑难”相关问题
·SQL Server 2005:你应知道的13件事
·实例解析:减少SQL日志大小的三个好方法
·使用SQL2000将现有代码作为Web服务提供
·sql server 2000数据库置疑的解决方法
·SQL Server安全问题全攻略之口令
·XP上不能安装MicrosoftSQLSERVER2000吗
·解析Microsoft Sql Server中的like语句
·推荐;适合SQL初学者学习的SQL FAQ集锦
·SQL Server 2005 中的分区表和索引
·查询及删除重复记录的方法大全
·详细介绍优化SQL Server 2000的设置
·关于SQL SERVER 日志满的处理方法
·使用SQL Server 2000索引视图提高性能
·SQL server 2005安装问题汇总
热点TOP10
·SQL server 2005安装问题汇总
·常用SQL语句词典
·Sql server优化50法
·SQL2000 数据库安装说明
·SQL Server 2005 中的分区表和索引
·巴塞尔新资本协议概述
·SQL Server 练习题
·用SQL批量插入数据
·提高查询速度:SQL Server数据库优化方案
·查询及删除重复记录的方法大全
·SQL SERVER中的union,cube,rollup和cumpute运算符
·把SQL SERVER里表里的数据导出成为insert into 脚本
·解决用sa登录sql 2005失败的问题
·在SQL Server 2000里设置和使用数据库复制
·sql server日期时间函数
·Oracle 与SQL Server 2000常用函数对照
·Sql数据库MDF数据文件数据库恢复
·sql 经典语句
·解决方案 用户 sa 登录失败
·SQL Server 2005免费版本下载排行居首

把SQL SERVER里表里的数据导出成为insert into 脚本

日期:2007年3月30日 作者: 查看:[大字体 中字体 小字体]


--于数据库里创建如下存储过程

--使用方式 :proc_insert  ' 要导出的表名'

create proc proc_insert (@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+','''''''','''''''''''')' + '+'''''''''+' 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 then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'replace('+a.name+','''''''','''''''''''')' + '+'''''''''+' end'
 when a.xtype =59  then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(23),'+a.name +',2)'+' end'
 when a.xtype =58  then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'convert(varchar(23),'+a.name +',121)'+ '+'''''''''+' end'
 when a.xtype =52  then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(12),'+a.name +')'+' end'

[1] [2] 下一页 




上一篇:SQL优化34条

下一篇:关于Tomcat与MySQL连接池问题的详解

把SQL SERVER里表里的数据导出成为insert into 脚本 相关文章:
·photoshop修改照片成为美女教程
·EasyRecovery 604硬盘数据恢复软件技巧
·成为QQ会员不用付费?
·开机提示reboot and select proper boot device or insert boot Media in selected boot device的解决
·SQL server 2005安装问题汇总
·asp.net(C#)海量数据表高效率分页算法(易懂,不使用存储过程)
·Sql server优化50法
·SQL2000 数据库安装说明
·C#源码读取excel数据到程序中-SQL SERVER-到dataset中
·SQL数据库完全使用手册
把SQL SERVER里表里的数据导出成为insert into 脚本 相关软件:
·SQL Server 2000 基础系列课程视频
·Windows 2003 Server 简体中文企业版(免激活)ISO
·ACCESS数据库教程 北京大学的ACCESS教程
·爆出网站数据库路径
·Microsoft SQL Server 2005 Enterprise Edition SP1简体中文企业版
·简体中文 Windows 2000 Server 培训教程
·SQL/MYSQL/数据库教程专栏
·逐步精通数据库 sql server 视频教程
·MS SQL Server 2000 四合一
·VBS脚本病毒生成器 V1.0 版

特别声明:本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。
[打印本页] [关闭窗口] 转载请注明来源:http://www.vipcn.net
| 帮助(?) | 版权声明 | 友情连接 | 关于我们 | 信息发布
Copyright 2007 www.vipcn.net All Rights Reserved. 鄂ICP备05000083号Powered by:viphot