September 16, 2009 at 8:32 am
I have the following query:
SELECT COL1,COL2
FROM [SBA].DBO.[TABLE1]
FOR XML RAW, ROOT('DATA')
From the query above, how the query results, which is an xml can be stored in a folder?
Previously I say thank you very much for your help
king regards,
Eko Indriyawan
September 16, 2009 at 10:32 am
Do you mean as a file? SQL Server doesn't write to files. You can call this from SQLCMD and output to a file.
September 16, 2009 at 10:58 am
Yes, you're right. What I mean is the file.
Can you give an example to me to use SQLCMD in order to produce a file?
King Regards,
Eko Indriyawan
September 16, 2009 at 2:13 pm
September 16, 2009 at 2:29 pm
Ronzo has the type fo example that I would have given you. You can look up SQLCMD in Books Online and see examples.
t-SQL works inside the server. It's not built to interact with the file system.
September 16, 2009 at 2:45 pm
We are sorry, I still can not understand your explanation well. Are you willing to give more specific examples for me?
I have tried but failed.
Before I beg your pardon had made a lot of work.
Warm regards,
Eko Indriyawan
September 16, 2009 at 3:36 pm
The first part of the example would be placed in a text file. That's why the second part has the file name as "c:ameandpathofabovescript"
You create a text file that has the script you wish to run. Or the query. Then you submit that text file to SQLCMD as a parameter.
This is from the command line. Please open Books Online, and look up SQLCMD.
September 17, 2009 at 11:48 am
Thanks a lot. I've tried it with the help of Books Online. I've managed to do it. But I have to use the SQLCMD Mode. Can I execute the query by using Stored Procedure?
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply