Automating 'results to file' in script

From: Sydney Lotterby (sydney_at_infosearch.com)
Date: 08/07/04


Date: Sat, 7 Aug 2004 13:04:02 -0500


(Sql2K)
In QA, I would like to automatically send the results of a script to a
filename.
Now I have to select 'Results to File' before I run the script then specify
the filename afterwards.
Is there a way to do this?

Or ... can you tell me a better way to do what I am trying (see below)

declare @path varchar(128), @t char(1), @q char(1), @crlf char(2)
set @path = 'E:\MSSQL\MSSQL\BACKUP\DAILY\'
set @t = char(9)
set @q = ''''
set @crlf = char(13)+char(10)

SELECT 'BACKUP DATABASE '+name+@t+
 'TO DISK = '+@q+@path+'bu'+name+@q+@t+
 'WITH INIT,'+@t+
 'NAME = '+@q+'bu'+name+@q+
 @crlf+'GO'
from MASTER..sysdatabases
where name like 'isw%'
order by name



Relevant Pages

  • Re: using xml to save/open project data
    ... http://www.TransProCalc.org - Free translation project mgmt software ... set filename tk_getOpenfile ... Exec'ing the script you run it as a separate process, your script won't be able to access its vars. ... generating the xml file is easy enough. ...
    (comp.lang.tcl)
  • Re: Help me find 5 mistakes and than solution to thoes mistakes!
    ... > 8:# This script will create links to files from all of the filename ... > 10:# arguments provided on stdin if no filenames provided on command ...
    (Fedora)
  • Re: MIME - scripting and symbol substitutions
    ... This script is creating a text file with a different filename ... symbol called NEWFILENAME (which works, ... MIME from the command line with all options (so normal DCL ...
    (comp.os.vms)
  • Re: virtual server backups
    ... Here is the script. ... 'Save state the virtual machine ... Filename = MyArray) ... Set objVM = Nothing ...
    (microsoft.public.windows.server.general)
  • Help with os.spawnv
    ... I've had to migrate back to Python 2.1 and am now trying to use ... This script gets each Ascii file in the workspace, ... for filename in filenames ...
    (comp.lang.python)