Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
partha
Starting Member
4 Posts |
Posted - 2004-09-23 : 12:59:39
|
| i am trying to create a .csv file using bcp and xp_cmdshell under SQL Query Analyser. it does work but not creating any file under the folder folder that i want. anybody know why its not creating the file?here is my procedure:BeginDECLARE @FileName varchar(50), @bcpCommand varchar(2000)SET @FileName = REPLACE('c:\temp\test_'+CONVERT(char(8),GETDATE(),1)+'.csv','/','-')SET @bcpCommand = 'bcp "SELECT * FROM C2CColl..AcctInfo order by branchno" queryout "'SET @bcpCommand = @bcpCommand + @FileName + '" -U mylogin -P mypassword -c'EXEC master..xp_cmdshell @bcpCommand END |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-09-23 : 13:32:41
|
| What is your query? You are probably thinking the file should be created on your machine which is not true. When you run it from QA, it will create it on the database server.Tara |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-09-23 : 14:26:53
|
| So did you check the database server to see if it was created there and not on your machine?Tara |
 |
|
|
|
|
|