Write File via master..xp_cmdshell / bcp command
-- declare necessary string variable -- and define the command declare @cmd varchar(1000) set @cmd = 'bcp "SELECT * FROM [databasename].dbo.[tablname]"' set @cmd = @cmd + 'queryout "c:\test.txt" -c -S "localhost" -U "username" -P "password"' -- use -t ";" to export as csv --set @cmd = @cmd + 'queryout "c:\test.txt" -t ";" -c -S "localhost" -U "username" -P "password"' -- execute the defined command master..xp_cmdshell @cmd, no_output
Comments
Du mußt Dich einloggen um diesen Weblog kommentieren zu können!
There were no comments found for this weblog.