日期:2014-05-17 浏览次数:20515 次
USE test
GO
CREATE TABLE test_blan(x VARCHAR(100),y VARCHAR(100))
GO
INSERT INTO test_blan
SELECT 'a','a' UNION ALL
SELECT 's','s' UNION ALL
SELECT 'd','d' UNION ALL
SELECT 'f','f' UNION ALL
SELECT 'g','g' UNION ALL
SELECT 'q','q' UNION ALL
SELECT 'w','w' UNION ALL
SELECT 'e','e' UNION ALL
SELECT 'r','r' UNION ALL
SELECT 't','t' UNION ALL
SELECT 'y','y'
CREATE VIEW test_log AS SELECT 'root' l
CREATE TABLE TT(aa XML )
DECLARE @x XML
SET @x = (SELECT * FROM test_log IRoot,test_blan IData FOR XML AUTO)
INSERT TT VALUES (@x)
EXEC [master].sys.xp_cmdshell 'bcp TT out E:/123.xml -c -T -k'
EXEC [master].sys.xp_cmdshell 'bcp TT out E:/123.xml -c -T -k'
EXEC [master].sys.xp_cmdshell 'bcp Test.dbo.TT out E:/123.xml -c -T -k'