Wednesday, March 7, 2012

Removing headers from sql output

I'm writing a query which creates a script that I then want to be able to run, but can't get rid of the headers.

eg. my query is similar to this:
USE master
go
set nocount on
go
select 'restore database @.dbname = N' + "'" + db_name() + "'" + ','
go
select '@.filename' +convert(varchar(5),fileid)+ ' = N'+convert(varchar(50),filename)+',' from sysfiles
go

The output is similar this:
------------------------------------------------
restore database @.dbname = N'master',

---------------------
@.filename1 = Nd:\sysdata\SQL2000\MSSQL${instancename}\data\mast er.mdf,
@.filename2 = Nd:\sysdata\SQL2000\MSSQL${instancename}\data\mast log.ld,

I want to get rid of all the '---' and lines between the output.

Can anyone help please?Hello,

which database do you use ? Looks like MSSQL ?

Regards

Manfred Peter
(Alligator Company)
http://www.alligatorsql.com|||I'm writing the script for SQL2000 -

No comments:

Post a Comment