Click here to Skip to main content
12,395,310 members (63,577 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# SQL
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
Amu@184435
Updated 2-May-12 21:10pm
Maciej Los221.8K
v2

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 | Mobile
Web02 | 2.8.160721.1 | Last Updated 3 May 2012
Copyright © CodeProject, 1999-2016
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