Showing posts with label sets. Show all posts
Showing posts with label sets. Show all posts

Wednesday, March 28, 2012

How to create maintenance plan without Northwind and Pubs

When creating a new database maintenance plan, there are four
different sets of databases to select:
o All databases
o All system databases (master, model, and msdb)
o All user databases (all databases other than master, model, and
msdb)
o These databases ...
I think that the most useful choice would be "All user databases
(excluding Northwind and Pubs)". But there are no such choice. Why?
How can I exclude the two demo databases from "user databases"? I know
I can delete them or mark them offline, but do I have to? I still want
to use them sometimes and therefor keep online.
So far I have used the "These databases" choice but it's sometimes
hard to keep track of all new and deleted (and offlined) databases.
The "All user databases (excluding Northwind and Pubs)" would be a
perfect solutions.
If I backup all user databases INCLUDING Northwind and Pubs, how can I
make some kind of trigger to detect a new backup file on disk and
delete it? The deletion should occur before the file would be written
to tape.
MarkkuAnswering on your last paragraph.
You can add one more CmdExec step to the backup job:
if exist c:\backup\pubs*.bak del c:\backup\pubs*.bak
if exist c:\backup\Northwind*.bak del c:\backup\Northwind*.bak
Bart Simpson
On 2 Mar 2004 01:25:24 -0800, google@.netti.fi (Markku Vainio) wrote:
>When creating a new database maintenance plan, there are four
>different sets of databases to select:
> o All databases
> o All system databases (master, model, and msdb)
> o All user databases (all databases other than master, model, and
>msdb)
> o These databases ...
>I think that the most useful choice would be "All user databases
>(excluding Northwind and Pubs)". But there are no such choice. Why?
>How can I exclude the two demo databases from "user databases"? I know
>I can delete them or mark them offline, but do I have to? I still want
>to use them sometimes and therefor keep online.
>So far I have used the "These databases" choice but it's sometimes
>hard to keep track of all new and deleted (and offlined) databases.
>The "All user databases (excluding Northwind and Pubs)" would be a
>perfect solutions.
>If I backup all user databases INCLUDING Northwind and Pubs, how can I
>make some kind of trigger to detect a new backup file on disk and
>delete it? The deletion should occur before the file would be written
>to tape.
>Markku|||Bart Simpson <bartsimpson000@.yahoo.com> wrote in message news:<jvk940d4b2nrqud5gtn0bk2gjnfusgc96f@.4ax.com>...
> Answering on your last paragraph.
> You can add one more CmdExec step to the backup job:
> if exist c:\backup\pubs*.bak del c:\backup\pubs*.bak
> if exist c:\backup\Northwind*.bak del c:\backup\Northwind*.bak
Thanks for your thoughts, but my Enterprise Manager says, that "It is
not recommended that jobs created by the maintenance plan be modified
in any way." I think there are a good reason for this.
It seems that there isn't any good solution for the demo database
backup maintenance problem. I think it would be best to just avoid
using the "All user databases" choice. Selecting all needed databases
one by one is the safest choice.
Markku|||I always delete the demo databases from production machines. Why do you want
to litter the machine with those databases? IF you need it for some test or
so, you can always create them from the script files.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Markku Vainio" <google@.netti.fi> wrote in message
news:2a683d86.0403050940.4022d634@.posting.google.com...
> Bart Simpson <bartsimpson000@.yahoo.com> wrote in message
news:<jvk940d4b2nrqud5gtn0bk2gjnfusgc96f@.4ax.com>...
> > Answering on your last paragraph.
> > You can add one more CmdExec step to the backup job:
> >
> > if exist c:\backup\pubs*.bak del c:\backup\pubs*.bak
> > if exist c:\backup\Northwind*.bak del c:\backup\Northwind*.bak
> Thanks for your thoughts, but my Enterprise Manager says, that "It is
> not recommended that jobs created by the maintenance plan be modified
> in any way." I think there are a good reason for this.
> It seems that there isn't any good solution for the demo database
> backup maintenance problem. I think it would be best to just avoid
> using the "All user databases" choice. Selecting all needed databases
> one by one is the safest choice.
> Markku|||"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message news:<OQSfbpuAEHA.628@.TK2MSFTNGP10.phx.gbl>...
> I always delete the demo databases from production machines. Why do you want
> to litter the machine with those databases? IF you need it for some test or
> so, you can always create them from the script files.
Actually deleting the demo db's is the most straightforward idea. I
didn't earlier know how they can be rebuilt so I didn't want to lose
them ;-). Now I know. Thanks!
Markku

How to create maintenance plan without Northwind and Pubs

When creating a new database maintenance plan, there are four
different sets of databases to select:
o All databases
o All system databases (master, model, and msdb)
o All user databases (all databases other than master, model, and
msdb)
o These databases ...
I think that the most useful choice would be "All user databases
(excluding Northwind and Pubs)". But there are no such choice. Why?
How can I exclude the two demo databases from "user databases"? I know
I can delete them or mark them offline, but do I have to? I still want
to use them sometimes and therefor keep online.
So far I have used the "These databases" choice but it's sometimes
hard to keep track of all new and deleted (and offlined) databases.
The "All user databases (excluding Northwind and Pubs)" would be a
perfect solutions.
If I backup all user databases INCLUDING Northwind and Pubs, how can I
make some kind of trigger to detect a new backup file on disk and
delete it? The deletion should occur before the file would be written
to tape.
MarkkuAnswering on your last paragraph.
You can add one more CmdExec step to the backup job:
if exist c:\backup\pubs*.bak del c:\backup\pubs*.bak
if exist c:\backup\Northwind*.bak del c:\backup\Northwind*.bak
Bart Simpson
On 2 Mar 2004 01:25:24 -0800, google@.netti.fi (Markku Vainio) wrote:

>When creating a new database maintenance plan, there are four
>different sets of databases to select:
> o All databases
> o All system databases (master, model, and msdb)
> o All user databases (all databases other than master, model, and
>msdb)
> o These databases ...
>I think that the most useful choice would be "All user databases
>(excluding Northwind and Pubs)". But there are no such choice. Why?
>How can I exclude the two demo databases from "user databases"? I know
>I can delete them or mark them offline, but do I have to? I still want
>to use them sometimes and therefor keep online.
>So far I have used the "These databases" choice but it's sometimes
>hard to keep track of all new and deleted (and offlined) databases.
>The "All user databases (excluding Northwind and Pubs)" would be a
>perfect solutions.
>If I backup all user databases INCLUDING Northwind and Pubs, how can I
>make some kind of trigger to detect a new backup file on disk and
>delete it? The deletion should occur before the file would be written
>to tape.
>Markku|||Bart Simpson <bartsimpson000@.yahoo.com> wrote in message news:<jvk940d4b2nrqud5gtn0bk2gjnfu
sgc96f@.4ax.com>...
> Answering on your last paragraph.
> You can add one more CmdExec step to the backup job:
> if exist c:\backup\pubs*.bak del c:\backup\pubs*.bak
> if exist c:\backup\Northwind*.bak del c:\backup\Northwind*.bak
Thanks for your thoughts, but my Enterprise Manager says, that "It is
not recommended that jobs created by the maintenance plan be modified
in any way." I think there are a good reason for this.
It seems that there isn't any good solution for the demo database
backup maintenance problem. I think it would be best to just avoid
using the "All user databases" choice. Selecting all needed databases
one by one is the safest choice.
Markku|||I always delete the demo databases from production machines. Why do you want
to litter the machine with those databases? IF you need it for some test or
so, you can always create them from the script files.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Markku Vainio" <google@.netti.fi> wrote in message
news:2a683d86.0403050940.4022d634@.posting.google.com...
> Bart Simpson <bartsimpson000@.yahoo.com> wrote in message
news:<jvk940d4b2nrqud5gtn0bk2gjnfusgc96f@.4ax.com>...
> Thanks for your thoughts, but my Enterprise Manager says, that "It is
> not recommended that jobs created by the maintenance plan be modified
> in any way." I think there are a good reason for this.
> It seems that there isn't any good solution for the demo database
> backup maintenance problem. I think it would be best to just avoid
> using the "All user databases" choice. Selecting all needed databases
> one by one is the safest choice.
> Markku|||"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message news:<O
QSfbpuAEHA.628@.TK2MSFTNGP10.phx.gbl>...
> I always delete the demo databases from production machines. Why do you wa
nt
> to litter the machine with those databases? IF you need it for some test o
r
> so, you can always create them from the script files.
Actually deleting the demo db's is the most straightforward idea. I
didn't earlier know how they can be rebuilt so I didn't want to lose
them ;-). Now I know. Thanks!
Markkusql

Friday, March 9, 2012

how to create a dynamic Select statements in my C# project

hi, can someone teach me how to create a dynamic Select statements in my C#
project.
i have this sets of select statements that will return the table name and
fields...and that table name and fields are the one im going to use to
create my dynamic select statements...how can i do this'
thanksProbably the best answer is Don't! In a well-designed business process
application Dynamic SQL is rarely necessary and not often a good idea.
Dynamic SQL is bad news for many reasons to do with performance, security an
d
maintainability. The best practice in a tiered architecture is usually to
build data access code in stored procedures and views and then use
parameterized procedures as your application's entry point to the database.
If you are building a general purpose database admin tool then you might
want to consider putting dynamic code in your application, in which case you
would probably want to use the .Net SqlCommand class. Otherwise you may want
to come back with a bit more information about your requirements so that
someone can advise you better.
David Portas
SQL Server MVP
--|||If your question is about generating dynamic SQL statements using
Transact-SQL, see http://www.sommarskog.se/dynamic_sql.html for a
discussion.
To generate dynamic SQL in application code, simply build a string
containing the needed SQL statement and execute using one of the
System.Data.SqlClient objects. Use command parameters as needed.
Hope this helps.
Dan Guzman
SQL Server MVP
"cEciLlE" <cecille.regidor@.gmail.com> wrote in message
news:eHeK54rLFHA.3296@.TK2MSFTNGP15.phx.gbl...
> hi, can someone teach me how to create a dynamic Select statements in my
> C# project.
> i have this sets of select statements that will return the table name and
> fields...and that table name and fields are the one im going to use to
> create my dynamic select statements...how can i do this'
>
> thanks
>