Showing posts with label specified. Show all posts
Showing posts with label specified. Show all posts

Monday, March 19, 2012

Get value from query to update another another table

I have a query that simply slelcts the min value of a specified field
from one table, I want to take that value to update a field in
annother table, just can not figure it out.(rzito@.si.rr.com) writes:

Quote:

Originally Posted by

I have a query that simply slelcts the min value of a specified field
from one table, I want to take that value to update a field in
annother table, just can not figure it out.


UPDATE tbl
SET col = (SELECT MIN(somecol) FROM othertbl)
WHERE ...

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

Wednesday, March 7, 2012

get specified permission to an object

Hi
How can I get information of permission of a user to an object in a database
.
Even if the permission was granted to the user any way:
by a database role
by an aplication role
by direct grant
by the user member of an NT group which group is in 'users' on the database
(trusted conn.)
etc.
I have to know after the connect to the database if the user have permission
or not to read - write the database tables.
Thank for any idea.
Imre AmentCheck out sp_helprotect in the BOL.
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
"permission to an object" <permission to an
object@.discussions.microsoft.com> wrote in message
news:BE12E14B-915E-4D6B-B5A1-08ACB267E757@.microsoft.com...
Hi
How can I get information of permission of a user to an object in a
database.
Even if the permission was granted to the user any way:
by a database role
by an aplication role
by direct grant
by the user member of an NT group which group is in 'users' on the database
(trusted conn.)
etc.
I have to know after the connect to the database if the user have permission
or not to read - write the database tables.
Thank for any idea.
Imre Ament|||Hi,
To see the object level permissions granted using "GRANT"statement see
sp_helprotect <object_name>,'user_name'
To see the assigned roles to the user in all database, execute below
sp_helplogins <Login_name>
To see the roles in a partcular database
use <dbname>
go
sp_helpuser <user_name>
Thanks
Hari
MCDBA
"permission to an object" <permission to an
object@.discussions.microsoft.com> wrote in message
news:BE12E14B-915E-4D6B-B5A1-08ACB267E757@.microsoft.com...
> Hi
> How can I get information of permission of a user to an object in a
database.
> Even if the permission was granted to the user any way:
> by a database role
> by an aplication role
> by direct grant
> by the user member of an NT group which group is in 'users' on the
database (trusted conn.)
> etc.
> I have to know after the connect to the database if the user have
permission or not to read - write the database tables.
> Thank for any idea.
> Imre Ament
>