将表数据生成SQL脚本的存储过程和工具(2)
来源:互联网 责任编辑:admin 发表时间:2013-07-01 08:10 点击:次
when @xtype=58 then '''''''''+convert(char(16),'+@name+',120)+''''''''' --smalldatetime
when @xtype=36 then '''''''''+convert(char(36),'+@name+')+''''''''' --uniqueidentifier
else @name end
end
end
fetch next from syscolumns_cursor into @name,@xtype
end
close syscolumns_cursor
deallocate syscolumns_cursor
set @sql='set nocount on select ''insert '+@tablename+'('+@column+') values(''as ''--'','+@columndata+','')'' from '+@tablename
print '--'+@sql
exec(@sql)
if @ident is not null
print 'SET IDENTITY_INSERT '+@TableName+' OFF'
GO
exec UspOutputData 你的表名
工具介绍:
1 InstallShield自带一个把SQL数据库的结构和数据导出为脚本的功能,很好用,如果刚好要做打包,建议用这个,因为安装文件比较大,如果不是做打包不建议用。
2 SqlInsert是一个专门导出数据为脚本的小工具,速度没IS的快,但是一样好用。
相关新闻>>
- 发表评论
-
- 最新评论 进入详细评论页>>