Hi,
I need to check the primary and the foreign keys of
existing user tables in one table to create the
corresponding Data Model.
I execute the following procedure, i see the BOL and i
need to enter one linked server for the procedure execute
fine. Im not doing this because im doing this in the local
machine.
exec sp_primarykeys
How can i generate this Data Model or how can i get this
relations with the minimum effort?
Best RegardsCC&JM
Try put your local sever name and remember you have to enable access data
exec sp_serveroption 'Server','data access','true'
"CC&JM" <anonymous@.discussions.microsoft.com> wrote in message
news:bded01c47a14$cec4e000$a601280a@.phx.gbl...
> Hi,
> I need to check the primary and the foreign keys of
> existing user tables in one table to create the
> corresponding Data Model.
> I execute the following procedure, i see the BOL and i
> need to enter one linked server for the procedure execute
> fine. Im not doing this because im doing this in the local
> machine.
> exec sp_primarykeys
> How can i generate this Data Model or how can i get this
> relations with the minimum effort?
> Best Regards
>
Showing posts with label existing. Show all posts
Showing posts with label existing. Show all posts
Tuesday, March 27, 2012
Monday, March 26, 2012
exec permision for sql user
I have a sqlserver user in my DB.I need to grant that user executions permission on all the stored procedures existing in the DB and alos should get the exec permission on newly created SPs in future.How can i achieve this .
Thanks.There is no builtin role for executing stored procedures. You could make the user db_owner, but that will bring in a load of other permissions that you probably would not want the user to have. In order to solve the immediate problem, you could run this query, to generate all the grant statements:
select 'grant execute on ' + SPECIFIC_SCHEMA + '.' + SPECIFIC_NAME + ' to role'
from INFORMATION_SCHEMA.ROUTINES|||hey, thanks for the information.
what does it mean 'SPECIFIC_SCHEMA ' and specific_name' in the above query.|||Those are the two columns you need from the INFORMATION_SCHEMA.Routines view. You should be able to cut and paste the code as is. The only thing you have to change is the name of the user or role you are granting the permissions to.
Thanks.There is no builtin role for executing stored procedures. You could make the user db_owner, but that will bring in a load of other permissions that you probably would not want the user to have. In order to solve the immediate problem, you could run this query, to generate all the grant statements:
select 'grant execute on ' + SPECIFIC_SCHEMA + '.' + SPECIFIC_NAME + ' to role'
from INFORMATION_SCHEMA.ROUTINES|||hey, thanks for the information.
what does it mean 'SPECIFIC_SCHEMA ' and specific_name' in the above query.|||Those are the two columns you need from the INFORMATION_SCHEMA.Routines view. You should be able to cut and paste the code as is. The only thing you have to change is the name of the user or role you are granting the permissions to.
EXEC Command in all existing connections
If there any way to execute t-sql command in all connections in one time.
Example : if user insert a new record in table employees I like to notify
all users that are connected.
Aleksandar TalevYou could create a Trigger on the table for INSERT.
Have the Trigger fire the following :-
net send /users "New record added to table."
the /users switch will broadcast to all users connected to the server.
HTH
Ryan Waight, MCDBA, MCSE
"Aleksandar Talev" <alex@.semos.com.mk> wrote in message
news:Ocvv1YFqDHA.2500@.TK2MSFTNGP10.phx.gbl...
> If there any way to execute t-sql command in all connections in one time.
>
> Example : if user insert a new record in table employees I like to notify
> all users that are connected.
>
> Aleksandar Talev
>
>|||This is very helpfull
Thanks.
I also like to know can I substitute net send command with osql or bcp
(including also all users) ?
AT
"Ryan Waight" <Ryan_Waight@.nospam.hotmail.com> wrote in message
news:#ShJRoFqDHA.1124@.TK2MSFTNGP09.phx.gbl...
> You could create a Trigger on the table for INSERT.
> Have the Trigger fire the following :-
> net send /users "New record added to table."
> the /users switch will broadcast to all users connected to the server.
>
> --
> HTH
> Ryan Waight, MCDBA, MCSE
> "Aleksandar Talev" <alex@.semos.com.mk> wrote in message
> news:Ocvv1YFqDHA.2500@.TK2MSFTNGP10.phx.gbl...
> > If there any way to execute t-sql command in all connections in one
time.
> >
> >
> > Example : if user insert a new record in table employees I like to
notify
> > all users that are connected.
> >
> >
> > Aleksandar Talev
> >
> >
> >
> >
>
Example : if user insert a new record in table employees I like to notify
all users that are connected.
Aleksandar TalevYou could create a Trigger on the table for INSERT.
Have the Trigger fire the following :-
net send /users "New record added to table."
the /users switch will broadcast to all users connected to the server.
HTH
Ryan Waight, MCDBA, MCSE
"Aleksandar Talev" <alex@.semos.com.mk> wrote in message
news:Ocvv1YFqDHA.2500@.TK2MSFTNGP10.phx.gbl...
> If there any way to execute t-sql command in all connections in one time.
>
> Example : if user insert a new record in table employees I like to notify
> all users that are connected.
>
> Aleksandar Talev
>
>|||This is very helpfull
Thanks.
I also like to know can I substitute net send command with osql or bcp
(including also all users) ?
AT
"Ryan Waight" <Ryan_Waight@.nospam.hotmail.com> wrote in message
news:#ShJRoFqDHA.1124@.TK2MSFTNGP09.phx.gbl...
> You could create a Trigger on the table for INSERT.
> Have the Trigger fire the following :-
> net send /users "New record added to table."
> the /users switch will broadcast to all users connected to the server.
>
> --
> HTH
> Ryan Waight, MCDBA, MCSE
> "Aleksandar Talev" <alex@.semos.com.mk> wrote in message
> news:Ocvv1YFqDHA.2500@.TK2MSFTNGP10.phx.gbl...
> > If there any way to execute t-sql command in all connections in one
time.
> >
> >
> > Example : if user insert a new record in table employees I like to
notify
> > all users that are connected.
> >
> >
> > Aleksandar Talev
> >
> >
> >
> >
>
Friday, March 23, 2012
Exclusive use during restore - need answer asap
I'm trying to restore a database back to two nights ago. I
choose the backup I want and the force over existing
database option. It comes back with I need exclusive use
of db. How do I find out who else is on the db? I did
the sp_who active proc and the only one that shows up is
the sa account and me.
HELP!Sp_who should of done it.
Another way of finding out is in EM selecting your server,
then Managment Current Activity, Process Info.
One of the oddities of SQL server is if you have two
connections to the db, then it will not allow you restore.
Peter
"Adam and Eve had many advantages but the principal one
was that they escaped teething."
Mark Twain
>--Original Message--
>I'm trying to restore a database back to two nights ago.
I
>choose the backup I want and the force over existing
>database option. It comes back with I need exclusive use
>of db. How do I find out who else is on the db? I did
>the sp_who active proc and the only one that shows up is
>the sa account and me.
>HELP!
>.
>|||Hi
If it is sa and you, that makes it 2. sp_who or sp_who2 are the correct SP's
to run. You need to get rid of the sa connection in able to restore the DB.
Cheers
Mike
"Edie Richardson" wrote:
> I'm trying to restore a database back to two nights ago. I
> choose the backup I want and the force over existing
> database option. It comes back with I need exclusive use
> of db. How do I find out who else is on the db? I did
> the sp_who active proc and the only one that shows up is
> the sa account and me.
> HELP!
>|||"Edie Richardson" <anonymous@.discussions.microsoft.com> wrote in message
news:48d301c4a17c$928a2480$a501280a@.phx.gbl...
> I'm trying to restore a database back to two nights ago. I
> choose the backup I want and the force over existing
> database option. It comes back with I need exclusive use
> of db. How do I find out who else is on the db? I did
> the sp_who active proc and the only one that shows up is
> the sa account and me.
>
Don't do sp_who active as even inactive connections can be a problem.
Just use sp_who
(or select * from sysprocesses where dbid= your database id)
> HELP!
choose the backup I want and the force over existing
database option. It comes back with I need exclusive use
of db. How do I find out who else is on the db? I did
the sp_who active proc and the only one that shows up is
the sa account and me.
HELP!Sp_who should of done it.
Another way of finding out is in EM selecting your server,
then Managment Current Activity, Process Info.
One of the oddities of SQL server is if you have two
connections to the db, then it will not allow you restore.
Peter
"Adam and Eve had many advantages but the principal one
was that they escaped teething."
Mark Twain
>--Original Message--
>I'm trying to restore a database back to two nights ago.
I
>choose the backup I want and the force over existing
>database option. It comes back with I need exclusive use
>of db. How do I find out who else is on the db? I did
>the sp_who active proc and the only one that shows up is
>the sa account and me.
>HELP!
>.
>|||Hi
If it is sa and you, that makes it 2. sp_who or sp_who2 are the correct SP's
to run. You need to get rid of the sa connection in able to restore the DB.
Cheers
Mike
"Edie Richardson" wrote:
> I'm trying to restore a database back to two nights ago. I
> choose the backup I want and the force over existing
> database option. It comes back with I need exclusive use
> of db. How do I find out who else is on the db? I did
> the sp_who active proc and the only one that shows up is
> the sa account and me.
> HELP!
>|||"Edie Richardson" <anonymous@.discussions.microsoft.com> wrote in message
news:48d301c4a17c$928a2480$a501280a@.phx.gbl...
> I'm trying to restore a database back to two nights ago. I
> choose the backup I want and the force over existing
> database option. It comes back with I need exclusive use
> of db. How do I find out who else is on the db? I did
> the sp_who active proc and the only one that shows up is
> the sa account and me.
>
Don't do sp_who active as even inactive connections can be a problem.
Just use sp_who
(or select * from sysprocesses where dbid= your database id)
> HELP!
Wednesday, March 21, 2012
Exclusive access could not be obtained because the database is in use.
How to close the existing connections to a particluar database in sql server. Please note that i donot want to start stop sql server. I just want to close the existing connections so that i can do a restore on that database programatically.
I am using sqldmo for this purpose. Does anyone knows how to do that with sqldmo or is there any other method??
Waiting for your earliest repliessp_who2
followed by
kill <process id>
Subscribe to:
Posts (Atom)