sql server遍历用户表导出所有表数据到文本
sql server遍历用户表相信大家都有一些了解,下面为您介绍的是sql server遍历用户表导出所有表数据到文本文件的方法,希望对您学习sql server遍历用户表方面能有所帮助。
- -- To allow advanced options to be changed.
- EXEC sp_configure 'show advanced options', 1
- GO
- -- To update the currently configured value for advanced options.
- RECONFIGURE
- GO
- -- To enable the feature.
- EXEC sp_configure 'xp_cmdshell', 1
- GO
- -- To update the currently configured value for this feature.
- RECONFIGURE
- GO
- ---xp_cmdshell 'cd C:Program FilesMicrosoft SQL Server90ToolsBin'
- xp_cmdshell 'dir *.exe'
- SELECT NAME,NAME FROM SYS.OBJECTS
- xp_cmdshell 'bcp northwind.dbo.orders out c:mytest -T -c'
- declare @sql nvarchar(max)
- set @sql=''
- select @sql=@sql+' xp_cmdshell '+'''bcp northwind.dbo.'+quotename(name)+' out c:'+name+'.dat -T -c '+''' ' from sys.objects
- where type='u';
- select @sql
- exec (@sql)
【编辑推荐】
SQL Server系统表的应用
Sql Server全文索引的迁移
SQL SERVER全文检索的实现
SQL Server删除用户失败的解决方法
sql server系统表说明
版权声明:
作者:后浪云
链接:https://www.idc.net/help/308486/
文章版权归作者所有,未经允许请勿转载。
THE END