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 -
Showing posts with label rid. Show all posts
Showing posts with label rid. Show all posts
Wednesday, March 7, 2012
Removing Extra Transaction Logs
I created some extra transaction logs for a database because of a lack of space however I want to now get rid of those and only have one primary transaction log. I cannot move data into other files like you can with a filegroup, how do I get rid of the files ?Originally posted by yorkie
Q1 I created some extra transaction logs for a database because of a lack of space however I want to now get rid of those and only have one primary transaction log. I cannot move data into other files like you can with a filegroup, how do I get rid of the files ?
-- A1 First empty the TL file(s) then remove it (them) from the DB. For example:
dbcc ShrinkFile('TL_FileName', EmptyFile)
Go
-- Then alter the DB to remove it
Alter Database DBName
Remove File TL_FileName
Go|||Thanks, worked a treat.
Q1 I created some extra transaction logs for a database because of a lack of space however I want to now get rid of those and only have one primary transaction log. I cannot move data into other files like you can with a filegroup, how do I get rid of the files ?
-- A1 First empty the TL file(s) then remove it (them) from the DB. For example:
dbcc ShrinkFile('TL_FileName', EmptyFile)
Go
-- Then alter the DB to remove it
Alter Database DBName
Remove File TL_FileName
Go|||Thanks, worked a treat.
Saturday, February 25, 2012
Removing differential backup
I set up a differential backup on my SQL server and have
decided I would rather not have it. However, I can't seem
to get rid of it. Any suggestions?
Hello John
How did you setup the differential backups? Was it setup as a SQLAgent
scheduled job?
If it is setup as a scheduled SQLAgent job, I'm not sure what is preventing
you from disabling/removing the job that performs SQL differential backups.
Could you please elaborate more on what you experience when you try to
disable or delete the job from SQLAgent job list in Enterprise Manager?
Thank you for using Microsoft newsgroups.
Sincerely
Pankaj Agarwal
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.
|||It was set up through Enterprise Manager by selecting the
database then selecting "all tasks:, I then chose Backup
database then selected Differential Backup. I chose a time
of 3:00 AM.
>--Original Message--
>Hello John
>How did you setup the differential backups? Was it setup
as a SQLAgent
>scheduled job?
>If it is setup as a scheduled SQLAgent job, I'm not sure
what is preventing
>you from disabling/removing the job that performs SQL
differential backups.
>Could you please elaborate more on what you experience
when you try to
>disable or delete the job from SQLAgent job list in
Enterprise Manager?
>Thank you for using Microsoft newsgroups.
>Sincerely
>Pankaj Agarwal
>Microsoft Corporation
>This posting is provided AS IS with no warranties, and
confers no rights.
>.
>
|||If you scheduled it there would be a scheduled job that issues the Diff
backup. Simply delete the job. If you didn't schedule a time it would have
been a one shot deal and there is nothing to worry about.
Andrew J. Kelly SQL MVP
"John Schuster" <schuster@.llnl.gov> wrote in message
news:043c01c4a0e2$306adfa0$a301280a@.phx.gbl...[vbcol=seagreen]
> It was set up through Enterprise Manager by selecting the
> database then selecting "all tasks:, I then chose Backup
> database then selected Differential Backup. I chose a time
> of 3:00 AM.
> as a SQLAgent
> what is preventing
> differential backups.
> when you try to
> Enterprise Manager?
> confers no rights.
decided I would rather not have it. However, I can't seem
to get rid of it. Any suggestions?
Hello John
How did you setup the differential backups? Was it setup as a SQLAgent
scheduled job?
If it is setup as a scheduled SQLAgent job, I'm not sure what is preventing
you from disabling/removing the job that performs SQL differential backups.
Could you please elaborate more on what you experience when you try to
disable or delete the job from SQLAgent job list in Enterprise Manager?
Thank you for using Microsoft newsgroups.
Sincerely
Pankaj Agarwal
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.
|||It was set up through Enterprise Manager by selecting the
database then selecting "all tasks:, I then chose Backup
database then selected Differential Backup. I chose a time
of 3:00 AM.
>--Original Message--
>Hello John
>How did you setup the differential backups? Was it setup
as a SQLAgent
>scheduled job?
>If it is setup as a scheduled SQLAgent job, I'm not sure
what is preventing
>you from disabling/removing the job that performs SQL
differential backups.
>Could you please elaborate more on what you experience
when you try to
>disable or delete the job from SQLAgent job list in
Enterprise Manager?
>Thank you for using Microsoft newsgroups.
>Sincerely
>Pankaj Agarwal
>Microsoft Corporation
>This posting is provided AS IS with no warranties, and
confers no rights.
>.
>
|||If you scheduled it there would be a scheduled job that issues the Diff
backup. Simply delete the job. If you didn't schedule a time it would have
been a one shot deal and there is nothing to worry about.
Andrew J. Kelly SQL MVP
"John Schuster" <schuster@.llnl.gov> wrote in message
news:043c01c4a0e2$306adfa0$a301280a@.phx.gbl...[vbcol=seagreen]
> It was set up through Enterprise Manager by selecting the
> database then selecting "all tasks:, I then chose Backup
> database then selected Differential Backup. I chose a time
> of 3:00 AM.
> as a SQLAgent
> what is preventing
> differential backups.
> when you try to
> Enterprise Manager?
> confers no rights.
Removing differential backup
I set up a differential backup on my SQL server and have
decided I would rather not have it. However, I can't seem
to get rid of it. Any suggestions?Hello John
How did you setup the differential backups? Was it setup as a SQLAgent
scheduled job?
If it is setup as a scheduled SQLAgent job, I'm not sure what is preventing
you from disabling/removing the job that performs SQL differential backups.
Could you please elaborate more on what you experience when you try to
disable or delete the job from SQLAgent job list in Enterprise Manager?
Thank you for using Microsoft newsgroups.
Sincerely
Pankaj Agarwal
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.|||It was set up through Enterprise Manager by selecting the
database then selecting "all tasks:, I then chose Backup
database then selected Differential Backup. I chose a time
of 3:00 AM.
>--Original Message--
>Hello John
>How did you setup the differential backups? Was it setup
as a SQLAgent
>scheduled job?
>If it is setup as a scheduled SQLAgent job, I'm not sure
what is preventing
>you from disabling/removing the job that performs SQL
differential backups.
>Could you please elaborate more on what you experience
when you try to
>disable or delete the job from SQLAgent job list in
Enterprise Manager?
>Thank you for using Microsoft newsgroups.
>Sincerely
>Pankaj Agarwal
>Microsoft Corporation
>This posting is provided AS IS with no warranties, and
confers no rights.
>.
>|||If you scheduled it there would be a scheduled job that issues the Diff
backup. Simply delete the job. If you didn't schedule a time it would have
been a one shot deal and there is nothing to worry about.
--
Andrew J. Kelly SQL MVP
"John Schuster" <schuster@.llnl.gov> wrote in message
news:043c01c4a0e2$306adfa0$a301280a@.phx.gbl...
> It was set up through Enterprise Manager by selecting the
> database then selecting "all tasks:, I then chose Backup
> database then selected Differential Backup. I chose a time
> of 3:00 AM.
> >--Original Message--
> >Hello John
> >
> >How did you setup the differential backups? Was it setup
> as a SQLAgent
> >scheduled job?
> >If it is setup as a scheduled SQLAgent job, I'm not sure
> what is preventing
> >you from disabling/removing the job that performs SQL
> differential backups.
> >Could you please elaborate more on what you experience
> when you try to
> >disable or delete the job from SQLAgent job list in
> Enterprise Manager?
> >
> >Thank you for using Microsoft newsgroups.
> >
> >Sincerely
> >
> >Pankaj Agarwal
> >Microsoft Corporation
> >
> >This posting is provided AS IS with no warranties, and
> confers no rights.
> >
> >.
> >
decided I would rather not have it. However, I can't seem
to get rid of it. Any suggestions?Hello John
How did you setup the differential backups? Was it setup as a SQLAgent
scheduled job?
If it is setup as a scheduled SQLAgent job, I'm not sure what is preventing
you from disabling/removing the job that performs SQL differential backups.
Could you please elaborate more on what you experience when you try to
disable or delete the job from SQLAgent job list in Enterprise Manager?
Thank you for using Microsoft newsgroups.
Sincerely
Pankaj Agarwal
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.|||It was set up through Enterprise Manager by selecting the
database then selecting "all tasks:, I then chose Backup
database then selected Differential Backup. I chose a time
of 3:00 AM.
>--Original Message--
>Hello John
>How did you setup the differential backups? Was it setup
as a SQLAgent
>scheduled job?
>If it is setup as a scheduled SQLAgent job, I'm not sure
what is preventing
>you from disabling/removing the job that performs SQL
differential backups.
>Could you please elaborate more on what you experience
when you try to
>disable or delete the job from SQLAgent job list in
Enterprise Manager?
>Thank you for using Microsoft newsgroups.
>Sincerely
>Pankaj Agarwal
>Microsoft Corporation
>This posting is provided AS IS with no warranties, and
confers no rights.
>.
>|||If you scheduled it there would be a scheduled job that issues the Diff
backup. Simply delete the job. If you didn't schedule a time it would have
been a one shot deal and there is nothing to worry about.
--
Andrew J. Kelly SQL MVP
"John Schuster" <schuster@.llnl.gov> wrote in message
news:043c01c4a0e2$306adfa0$a301280a@.phx.gbl...
> It was set up through Enterprise Manager by selecting the
> database then selecting "all tasks:, I then chose Backup
> database then selected Differential Backup. I chose a time
> of 3:00 AM.
> >--Original Message--
> >Hello John
> >
> >How did you setup the differential backups? Was it setup
> as a SQLAgent
> >scheduled job?
> >If it is setup as a scheduled SQLAgent job, I'm not sure
> what is preventing
> >you from disabling/removing the job that performs SQL
> differential backups.
> >Could you please elaborate more on what you experience
> when you try to
> >disable or delete the job from SQLAgent job list in
> Enterprise Manager?
> >
> >Thank you for using Microsoft newsgroups.
> >
> >Sincerely
> >
> >Pankaj Agarwal
> >Microsoft Corporation
> >
> >This posting is provided AS IS with no warranties, and
> confers no rights.
> >
> >.
> >
Monday, February 20, 2012
removing a snapshot agent.
I have a snapshot agent that I cannot get rid of. The publication did
not exist, so I went into distribution.MSsnapshot_agents table and
delete it. When I refresh the snapshot agents folder, it is gone. At
some point, the damn thing gets recreated.
What is recreating this agent? How can I stop it for being recreated?
Larry...
Are you using dynamic snapshots? This is a merge replicaiton only feature.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"LPR-3rd" <lreames@.gmail.com> wrote in message
news:1115044813.754502.295220@.f14g2000cwb.googlegr oups.com...
> I have a snapshot agent that I cannot get rid of. The publication did
> not exist, so I went into distribution.MSsnapshot_agents table and
> delete it. When I refresh the snapshot agents folder, it is gone. At
> some point, the damn thing gets recreated.
> What is recreating this agent? How can I stop it for being recreated?
> Larry...
>
|||I am not using dynamic snapshots. It is a simple transactional pub.
What do you mean..'This is a merge replicaiton only feature.'?
not exist, so I went into distribution.MSsnapshot_agents table and
delete it. When I refresh the snapshot agents folder, it is gone. At
some point, the damn thing gets recreated.
What is recreating this agent? How can I stop it for being recreated?
Larry...
Are you using dynamic snapshots? This is a merge replicaiton only feature.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"LPR-3rd" <lreames@.gmail.com> wrote in message
news:1115044813.754502.295220@.f14g2000cwb.googlegr oups.com...
> I have a snapshot agent that I cannot get rid of. The publication did
> not exist, so I went into distribution.MSsnapshot_agents table and
> delete it. When I refresh the snapshot agents folder, it is gone. At
> some point, the damn thing gets recreated.
> What is recreating this agent? How can I stop it for being recreated?
> Larry...
>
|||I am not using dynamic snapshots. It is a simple transactional pub.
What do you mean..'This is a merge replicaiton only feature.'?
removing a snapshot agent.
I have a snapshot agent that I cannot get rid of. The publication did
not exist, so I went into distribution.MSsnapshot_agents table and
delete it. When I refresh the snapshot agents folder, it is gone. At
some point, the damn thing gets recreated.
I am not using dynamic snapshots. It is a simple transactional pub.
What is recreating this agent? How can I stop it for being recreated?
Larry...
A stray snapshot agent job that runs periodically may be re-creating the
snapshot agent entry in MSsnapshot_agent. Can you check whether there is a
snapshot agent job step in sysjobsteps that doesn't correspond to any known
publications?
"LPR-3rd" wrote:
> I have a snapshot agent that I cannot get rid of. The publication did
> not exist, so I went into distribution.MSsnapshot_agents table and
> delete it. When I refresh the snapshot agents folder, it is gone. At
> some point, the damn thing gets recreated.
> I am not using dynamic snapshots. It is a simple transactional pub.
> What is recreating this agent? How can I stop it for being recreated?
>
> Larry...
>
not exist, so I went into distribution.MSsnapshot_agents table and
delete it. When I refresh the snapshot agents folder, it is gone. At
some point, the damn thing gets recreated.
I am not using dynamic snapshots. It is a simple transactional pub.
What is recreating this agent? How can I stop it for being recreated?
Larry...
A stray snapshot agent job that runs periodically may be re-creating the
snapshot agent entry in MSsnapshot_agent. Can you check whether there is a
snapshot agent job step in sysjobsteps that doesn't correspond to any known
publications?
"LPR-3rd" wrote:
> I have a snapshot agent that I cannot get rid of. The publication did
> not exist, so I went into distribution.MSsnapshot_agents table and
> delete it. When I refresh the snapshot agents folder, it is gone. At
> some point, the damn thing gets recreated.
> I am not using dynamic snapshots. It is a simple transactional pub.
> What is recreating this agent? How can I stop it for being recreated?
>
> Larry...
>
Subscribe to:
Posts (Atom)