Click here to Skip to main content
13,189,324 members (76,980 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I want to create and Write into text file using sql.
I had written following code:

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 2-May-12 21:05pm
Updated 2-May-12 21:10pm
Maciej Los256.6K

1 solution

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.171016.2 | Last Updated 3 May 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100