Automating 'results to file' in script
From: Sydney Lotterby (sydney_at_infosearch.com)
Date: 08/07/04
- Next message: David Portas: "Re: Is there a way...?"
- Previous message: blinton25: "Reuse Connection for Temp Tables"
- Next in thread: Jacco Schalkwijk: "Re: Automating 'results to file' in script"
- Reply: Jacco Schalkwijk: "Re: Automating 'results to file' in script"
- Messages sorted by: [ date ] [ thread ]
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
- Next message: David Portas: "Re: Is there a way...?"
- Previous message: blinton25: "Reuse Connection for Temp Tables"
- Next in thread: Jacco Schalkwijk: "Re: Automating 'results to file' in script"
- Reply: Jacco Schalkwijk: "Re: Automating 'results to file' in script"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|