Hi there
I want to add a bit to my SQL script which will check whether the
database exists before running the script. I am aware of the syntax for
checking for the database and dropping the database if necessary, but I
want to keep the database if it exists. The trouble is that because I
need GO statements in the script, I cannot put an IF EXISTS around the
whole thing?
Would anyone be able to help?
Thanks
DaveIf you run the script using ISQL or OSQL, you can issue a RAISERROR with *st
ate* of 127, which will
terminate the script (not only the batch). If you run from somewhere else, y
ou can use the technique
that instpubs.sql does, i.e., issue an error with a high *severity* level so
that *SQL Server*
terminates the connection.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"Bungle" <dave@.court-technologies.com> wrote in message
news:1106556674.118686.293460@.f14g2000cwb.googlegroups.com...
> Hi there
> I want to add a bit to my SQL script which will check whether the
> database exists before running the script. I am aware of the syntax for
> checking for the database and dropping the database if necessary, but I
> want to keep the database if it exists. The trouble is that because I
> need GO statements in the script, I cannot put an IF EXISTS around the
> whole thing?
> Would anyone be able to help?
> Thanks
> Dave
>
Showing posts with label thedatabase. Show all posts
Showing posts with label thedatabase. Show all posts
Wednesday, March 7, 2012
Sunday, February 19, 2012
Domain Accounts
Is it possible to assign users to Active Directory groups
and have this one group account granted access in the
database with the appropriate permissions. As oppose to
having many individual Windows domain accounts.
Thanks,
Angelina
Hi angelina
You can grant a login to a group as well as individuals see the
documentation for sp_grantlogin in Books online.
If you allow access to the group all member will have that permission and
therefore it is easier to administer.
John
"angelina" <anonymous@.discussions.microsoft.com> wrote in message
news:43f901c42b7f$249f7f10$a101280a@.phx.gbl...
> Is it possible to assign users to Active Directory groups
> and have this one group account granted access in the
> database with the appropriate permissions. As oppose to
> having many individual Windows domain accounts.
> Thanks,
> Angelina
and have this one group account granted access in the
database with the appropriate permissions. As oppose to
having many individual Windows domain accounts.
Thanks,
Angelina
Hi angelina
You can grant a login to a group as well as individuals see the
documentation for sp_grantlogin in Books online.
If you allow access to the group all member will have that permission and
therefore it is easier to administer.
John
"angelina" <anonymous@.discussions.microsoft.com> wrote in message
news:43f901c42b7f$249f7f10$a101280a@.phx.gbl...
> Is it possible to assign users to Active Directory groups
> and have this one group account granted access in the
> database with the appropriate permissions. As oppose to
> having many individual Windows domain accounts.
> Thanks,
> Angelina
Domain Accounts
Is it possible to assign users to Active Directory groups
and have this one group account granted access in the
database with the appropriate permissions. As oppose to
having many individual Windows domain accounts.
Thanks,
AngelinaHi angelina
You can grant a login to a group as well as individuals see the
documentation for sp_grantlogin in Books online.
If you allow access to the group all member will have that permission and
therefore it is easier to administer.
John
"angelina" <anonymous@.discussions.microsoft.com> wrote in message
news:43f901c42b7f$249f7f10$a101280a@.phx.gbl...
> Is it possible to assign users to Active Directory groups
> and have this one group account granted access in the
> database with the appropriate permissions. As oppose to
> having many individual Windows domain accounts.
> Thanks,
> Angelina
and have this one group account granted access in the
database with the appropriate permissions. As oppose to
having many individual Windows domain accounts.
Thanks,
AngelinaHi angelina
You can grant a login to a group as well as individuals see the
documentation for sp_grantlogin in Books online.
If you allow access to the group all member will have that permission and
therefore it is easier to administer.
John
"angelina" <anonymous@.discussions.microsoft.com> wrote in message
news:43f901c42b7f$249f7f10$a101280a@.phx.gbl...
> Is it possible to assign users to Active Directory groups
> and have this one group account granted access in the
> database with the appropriate permissions. As oppose to
> having many individual Windows domain accounts.
> Thanks,
> Angelina
Subscribe to:
Posts (Atom)