Re: Automating 'results to file' in script

From: Jacco Schalkwijk (jacco.please.reply_at_to.newsgroups.mvps.org.invalid)
Date: 08/07/04


Date: Sat, 7 Aug 2004 23:09:38 +0100

For generating script files you might be better of using the osql command
line tool. You can specify a script (your statement) as the input file (-i
switch) and another file as the output file (-o switch). See Books Online
for the complete syntax and some examples.

However, if you want to backup all databases, you might want to have a look
at maintenance plans in SQL Server. They have an option to backup all
databases, or either all user databases or all system databases.

-- 
Jacco Schalkwijk
SQL Server MVP
"Sydney Lotterby" <sydney@infosearch.com> wrote in message 
news:Op4osjKfEHA.2544@TK2MSFTNGP10.phx.gbl...
> (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: Need guidance
    ... Close all databases that are being shared by FM7 sever. ... Open FM7 pro 7 to execute a script that will import data from another file ... Open all databases in FM7 server to be shared. ...
    (comp.databases.filemaker)
  • Reverting to previous found set from script
    ... Hi guys and girls ... I'm new to FileMaker but not to databases in general. ... So the principles behind relational database operation aren't a problem for me to understand; what I'm having difficulty with is making FileMaker's script steps duplicate what I can do manually. ... If I am in a found set of records, or indeed am looking at all of them, when I click into find mode and enter something which I know can't be found, FileMaker presents an error message and allows me to continue or cancel. ...
    (comp.databases.filemaker)
  • Re: Script for your enjoyment
    ... Another environment specific aspect. ... I do not maintain any databases ... The script should do that for you. ... isn't anyone checking if a domain group exists before they add it". ...
    (microsoft.public.scripting.wsh)
  • Re: HTTP 403
    ... just saying HTTP 403. ... you've done it correctly) is that the first time it gets executed, ... Just the follow question as above - can I in your script use the input ...
    (comp.lang.php)
  • Re: HTTP 403
    ... just saying HTTP 403. ... What is happening with the way that you have coded your script (if ... to a valid form submission and the does whatever other processing you ...
    (comp.lang.php)