- 浏览: 437010 次
- 性别:
- 来自: 厦门
文章分类
最新评论
-
popotang:
ie6好像才会引起,而且githut上的最新版已经没有这个问题 ...
jquery.form.js ajaxsubmit上传文件 报对象不支持此属性或方法 -
ch_dj:
谢谢啊
j2se 用友面试题 -
chenzubin:
不错,支持一下
j2se 用友面试题
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 =127 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(20),'+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' when a.xtype =122 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(22),'+a.name +')'+' end' when a.xtype =48 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(6),'+a.name +')'+' end' -- when a.xtype =165 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 =167 then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'replace('+a.name+','''''''','''''''''''')' + '+'''''''''+' end' else '''NULL''' end as col,a.colid,a.name from syscolumns a where a.id = object_id(@tablename) and a.xtype <>189 and a.xtype <>34 and a.xtype <>35 and a.xtype <>36 )t order by colid select @sqlstr=@sqlstr+left(@sqlstr2,len(@sqlstr2)-1)+') '+left(@sqlstr1,len(@sqlstr1)-3)+')'' from '+@tablename -- print @sqlstr exec( @sqlstr) set nocount off end go
使用方法:
exec proc_insert 你的表名
另外可以利用第三方工具,导出饮食备注型字段的数据数据可以用powerbuilder。在database painter里面,用SQL选出,或者直接打开表,点击生成的list datawindow,然后在菜单file->save rows as->选择SQL,那么生成的SQL语句就包括建表和insert数据的SQL了。
还有最完善的方式就是自己编程实现导入导出,这样可以应对所有情况的数据转换。
发表评论
-
jdbc 大数据批量插入很慢问题解决
2019-07-02 17:21 2533普通的执行过程是:每处理一条数据,就访问一次数据库; ... -
查看mysql&sqlserver的一个数据库中各个表的数据量
2015-03-26 13:59 538mysql查看v3x数据库的表: use informati ... -
sql的AVG如何实现保留一位小数(数据库里为int型)?
2015-03-12 10:01 2209select b.unitCode,b.uni ... -
Sql Server 删除所有表
2015-03-09 11:27 653--/第1步**********删除所有表的外键约束***** ... -
sqlserver indexOf lastIndexOf
2015-01-13 13:53 1618//sqlserver lastIndexOf selec ... -
SQL Server数据库如何获取TEXT字段的内容长度
2015-01-12 14:45 1081SELECT length = DATALENGTH(pub_ ... -
Sqlserver 获取某个视图的字段名列表 获取某个表的字段名列表
2014-11-21 11:52 563--获取某个视图的字段名列表 Select o.Name A ... -
Sqlserver删除多表操作
2014-11-20 09:38 546DECLARE c2 cursor for sele ... -
ORA-22858: invalid alteration of datatype(varchar2转化clob)
2014-10-09 12:35 1292在11g下 --修改某字段类型 不能按照字段原来顺序( ... -
无法为数据库"xxxx"中的对象'xxxx'分配空间,因为'PRIMARY'文件组已满
2014-05-29 11:33 1436需要在文件--》添加--某个文件 具体参考如下: http: ... -
sqlserver text类型字段错误 net.sourceforge.jtds.jdbc.ClobImpl@66fa192的解决方法
2014-05-13 20:16 31251. SqlServer数据库中text/ntext字段,在用 ... -
svn number is larger than maximum
2014-04-11 19:27 16490svn number is larger than maxim ... -
电脑改密码,sqlserver要跟着改密码 否则用不了
2014-04-11 12:48 738我的电脑--》管理--》服务--》SQLServer--> ... -
数据库自动备份 并压缩 批处理工具 dbback-bat.rar
2014-03-19 12:56 513数据库自动备份 并压缩 批处理工具 详细如 附件。 -
PowerDesign16 Generate Java Code 生成Java代码
2014-03-18 13:52 1135常用的设置模板设置: 打开菜单栏 Language -> ... -
zip版tomcat(6,7)不能注册成windows服务或者注册后不能启动的问题解决
2013-11-23 18:45 572http://blog.csdn.net/bigbird201 ... -
oracle distinct 多列
2013-11-21 18:56 2382distinct这个关键字来过滤掉多余的重复记录只保留一条,但 ... -
Oracle中SQLPLUS的常用指令收集与技巧
2013-09-27 10:13 510Oracle中SQLPLUS的常用指令收集与技巧 http: ... -
oracle账户锁定解决方法
2013-08-17 09:54 1012SQL> conn /as sysdba 已 ... -
Hibernate like 模糊查询参数化的问题
2013-06-25 16:07 783其实造成这个问题的根本原因还是对hibernate的使用不太了 ...
相关推荐
从SQLSERVER数据库中导出记录生成insert into 语句
可以将数据库中的数据导出insert into脚本, sql server2008以上版本已经自带导出数据库数据成insert脚本功能,该工具针对2005以下版本.使用时先选择数据库服务器地址,在右侧选择Sql Server login,输入数据库账号...
SQL SERVER:把表里的数据导出成为INSERT INTO脚本的存储过程
可将sql server 数据表生成sql语句 语句中包括建表部分和数据部分 常用作sql server 数据导入 例如:--表 buyi_product_comment 的结构 CREATE TABLE buyi_product_comment(proId varchar(50) not null,companyid ...
由于sql server2005里没有像oracle那样将数据导出成sql语句(insert into)的功能。所以,写的一个存储过程,该存储过程将提成的表的数据全部生成insert into.....这样的插入语句。以便数据的复制。
把msSqlServer 中的数据导出成 insert into语句
根据表中的记录生成insert语句的脚本
怎样将表中数据导出,形成insert into 表名 values(...)这样的语句?独此一家 , 别无分号 支持sqlserver access oracle mysql 就用这个软件好了~!
Office数据库升迁 Access 导入 SQL Server,相信大家都知道 SQL-Server 数据库导入导出功能吧,但当你装了精简版的SQL-Server这个功能就会没有了,也就是无法实现数据库导入导出,那么怎么办 写SQL语句? Insert ...
[SQL]将Excel表数据导入SQL Server2005的几种方法归纳 数据库 2010-07-27 11:14:26 阅读201 评论0 字号:大中小 订阅 近日在巨轮着手车间负荷数据处理,反馈回来的数据是保存在Excel文件中的,我必须将其导入SQL ...
代码如下: DECLARE @tbImportTables table(tablename varchar(128), deleted tinyint) — append tables which you want to import Insert Into @tbImportTables(tablename, deleted) values(‘tentitytype’, 1) ...
为了处理SQL语句,Oracle将在内存中分配一个区域,这就是上下文区。这个区包含了已经处理完的行数、指向被分析语句的指针,整个区是查询语句返回的数据行集。游标就是指向上下文区句柄或指针。 1 显示游标 显示...
快速加大表中数据 insert into student(SNo,Name,Sex,Birthday,Salary) select * from student; www.2cto.com 改 update student set Name='陈慧琳',Sex='女' where SNo=1002; 删 savepoint a; delete ...
已针对数百种复杂,真实SQL语句进行了测试待办事项/计划中添加对CREATE,ALTER,DELETE,SELECT INTO语句的支持检测并引用保留的关键字名称根据SQL方言添加格式选项(例如,逗号开头/结尾,贪婪空格,上/下/驼峰式...
4-3 使用向导创建索引 158 6-4-4 利用“管理索引”窗口管理表索引 161 6-5 创建关联 162 6-6 数据输入 165 6-6-1 在表窗口中输入数据 165 6-6-2 导入数据 166 6-6-3 使用INSERT INTO语句 171...
6-6-3 使用INSERT INTO语句 171 第7章 数据库的备份与管理……………….173 7-1 生成数据库的SQL脚本 174 7-1-1 生成SQL脚本窗口 174 7-1-2 执行生成SQL脚本 179 7-1-3 执行SQL脚本文件 181 7-2 收缩...
实例071 在TListView控件中对数据排序或统计 84 实例072 在TListView组件中绘制底纹 86 实例073 在列表视图中拖动视图项 87 2.6 TTreeView控件应用典型实例 88 实例074 将数据库数据显示到树视图中 88 ...
为了处理SQL语句,Oracle将在内存中分配一个区域,这就是上下文区。这个区包含了已经处理完的行数、指向被分析语句的指针,整个区是查询语句返回的数据行集。游标就是指向上下文区句柄或指针。 显示游标 显示游标...