Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to create and Write into text file using sql.
I had written following code:

C#
Declare @Path varchar(5000)
Set @Path='D:\Data\Test.txt' 
declare @Command varchar(5000)
set @Command='echo "Hello World">' + @Path
exec master..xp_cmdshell @Command

But i am getting an error as "The system cannot find the path specified."

[EDIT]Code tags added - LOSMAC[/EDIT]
Posted
Updated 2-May-12 21:10pm
v2

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900