sqlserver遍历用户表导出所有表数据到文本
sql server遍历用户表相信大家都有一些了解,下面为您介绍的是sql server遍历用户表导出所有表数据到文本文件的方法,希望对您学习sql server遍历用户表方面能有所帮助。

10年积累的成都网站建设、成都做网站经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先网站制作后付款的网站建设流程,更有分宜免费网站建设让你可以放心的选择与我们合作。
- -- 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)
网页题目:sqlserver遍历用户表导出所有表数据到文本
本文网址:http://jxjierui.cn/article/coehohg.html


咨询
建站咨询
