Showing posts with label script. Show all posts
Showing posts with label script. Show all posts

Tuesday, March 27, 2012

Best to clear users before detaching a database.

What is the best way to clear users before using the stored procedure to
detach a database? I'm thinking about just writting a script to kill their
process before doing the detach command.
Thanks
DonAlter Database FooDB set offline with rollback immediate
go
Alter Database FooDB set online
--
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP
"Don" <Don@.discussions.microsoft.com> wrote in message
news:70D2D8A6-80A4-4A61-81A7-169AFED7AECB@.microsoft.com...
> What is the best way to clear users before using the stored procedure to
> detach a database? I'm thinking about just writting a script to kill
> their
> process before doing the detach command.
> Thanks
> Don|||Don,
EM provides this option (CLEAR) when you detach a database graphically -
also asks if notificition should passed on to disconnected users.
HTH
Jerry
"Don" <Don@.discussions.microsoft.com> wrote in message
news:70D2D8A6-80A4-4A61-81A7-169AFED7AECB@.microsoft.com...
> What is the best way to clear users before using the stored procedure to
> detach a database? I'm thinking about just writting a script to kill
> their
> process before doing the detach command.
> Thanks
> Don

Best to clear users before detaching a database.

What is the best way to clear users before using the stored procedure to
detach a database? I'm thinking about just writting a script to kill their
process before doing the detach command.
Thanks
DonAlter Database FooDB set offline with rollback immediate
go
Alter Database FooDB set online
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP
"Don" <Don@.discussions.microsoft.com> wrote in message
news:70D2D8A6-80A4-4A61-81A7-169AFED7AECB@.microsoft.com...
> What is the best way to clear users before using the stored procedure to
> detach a database? I'm thinking about just writting a script to kill
> their
> process before doing the detach command.
> Thanks
> Don|||Don,
EM provides this option (CLEAR) when you detach a database graphically -
also asks if notificition should passed on to disconnected users.
HTH
Jerry
"Don" <Don@.discussions.microsoft.com> wrote in message
news:70D2D8A6-80A4-4A61-81A7-169AFED7AECB@.microsoft.com...
> What is the best way to clear users before using the stored procedure to
> detach a database? I'm thinking about just writting a script to kill
> their
> process before doing the detach command.
> Thanks
> Don

Best to clear users before detaching a database.

What is the best way to clear users before using the stored procedure to
detach a database? I'm thinking about just writting a script to kill their
process before doing the detach command.
Thanks
Don
Alter Database FooDB set offline with rollback immediate
go
Alter Database FooDB set online
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP
"Don" <Don@.discussions.microsoft.com> wrote in message
news:70D2D8A6-80A4-4A61-81A7-169AFED7AECB@.microsoft.com...
> What is the best way to clear users before using the stored procedure to
> detach a database? I'm thinking about just writting a script to kill
> their
> process before doing the detach command.
> Thanks
> Don
|||Don,
EM provides this option (CLEAR) when you detach a database graphically -
also asks if notificition should passed on to disconnected users.
HTH
Jerry
"Don" <Don@.discussions.microsoft.com> wrote in message
news:70D2D8A6-80A4-4A61-81A7-169AFED7AECB@.microsoft.com...
> What is the best way to clear users before using the stored procedure to
> detach a database? I'm thinking about just writting a script to kill
> their
> process before doing the detach command.
> Thanks
> Don

Thursday, March 8, 2012

best practice connecting to run database creation script

I want to run a database creation sql script. The problem (I believe) is
that I have to specify the database I wish to connect to when connecting to
the server (ADO). Should I specify the Main database? Or is there a way
around this?
You can use master for the initial catalog in your
connection string.
-Sue
On Mon, 7 Nov 2005 13:01:03 -0800, "William Sullivan"
<WilliamSullivan@.discussions.microsoft.com> wrote:

>I want to run a database creation sql script. The problem (I believe) is
>that I have to specify the database I wish to connect to when connecting to
>the server (ADO). Should I specify the Main database? Or is there a way
>around this?

best practice connecting to run database creation script

I want to run a database creation sql script. The problem (I believe) is
that I have to specify the database I wish to connect to when connecting to
the server (ADO). Should I specify the Main database? Or is there a way
around this?You can use master for the initial catalog in your
connection string.
-Sue
On Mon, 7 Nov 2005 13:01:03 -0800, "William Sullivan"
<WilliamSullivan@.discussions.microsoft.com> wrote:

>I want to run a database creation sql script. The problem (I believe) is
>that I have to specify the database I wish to connect to when connecting to
>the server (ADO). Should I specify the Main database? Or is there a way
>around this?

Friday, February 24, 2012

Best (and simplest) practice for refreshing Test data

What is the best and simplest way to script a straightforward refresh of Test data from Production data in MS SQL 2005/Transact-SQL? (Just the data, not the objects.) Thanks.

If you have not yet had an opportunity to explore the Data Generator included with Visual Studio Team System for Database Professionals, I highly recommend that you download the 180 day eval and let the Data Generator 'blow your socks off'.

http://msdn2.microsoft.com/en-us/teamsystem/aa718807.aspx

http://msdn2.microsoft.com/en-us/teamsystem/aa718764.aspx

http://msdn2.microsoft.com/en-us/teamsystem/bb507197.aspx

Here you can download a virtualized version:

http://www.microsoft.com/downloads/details.aspx?FamilyID=9D60655E-814C-40A8-9762-53A40D8E7B37&displaylang=en

After you see the potentials for Test and Development data generation, you will no long try writing your own scripts.

|||

A series o scripts with "bcp out" from Production then another series with "bcp in" to Development (after a series of "truncate table ..").