As I mentioned, I can't just pass a query because the relations are
unpredictably deep and all of the data is in a single table. I am
re-creating a company organizational tree in XML form. (The purpose BTW is
to feed a treeview contorl in ASP.NET).
can't get it to work. Because I don't get errors of any kind I wonder if
there is a rights issue in SQL Server 2000. I created a user with admin
rights and then logged into Query Analyser to run the code, but got the same
result: no file and no errors. Here is the code I am running:
--Open a file
I am strong in programming but weak in DBA stuff. I see you are an MVP. I
hope you have a good idea on this one.
> Although I do not recall reading Aniths answer I suspect it would use
> OSQL -Q to pass in a query and -o to send the output to a flat file....
> is doc'd in books on line, and from the command prompt osql /? will
> its parameters.
> Wayne Snyder, MCDBA, SQL Server MVP
> Computer Education Services Corporation (CESC), C*te, NC
> (Please respond only to the newsgroups.)
> I support the Professional Association of SQL Server (PASS) and it's
> community of SQL Server professionals.
> > I need to create an XML file that represents our company tree. The data
> > relations are all contained in a single 'employee' database. Because it
> > impossible to predict the number of branches in the tree I can't use DTS
> > drop a dataset into a file and using an xml file with the "FOR XML AUTO"
> > won't work either for the same reson. These are the only 2 techinques I
> > familiar with to create a text file from SQL. I am a VB programmer and
> > there was a way to construct an external text file using a stored
> > (just like stringbuilder in VB) that might work best. I already have a
> > stored proc that can perform the work, I just need a command(s) that
> > the code to write it out to a text file and give the file a name. Does
> > anyone have any advice on where to look to find information on this, or
> > to do this?
> > Scott