Showing posts with label t-sql. Show all posts
Showing posts with label t-sql. Show all posts

Friday, March 23, 2012

Retrieving user roles

Since I can't find this information anywhere, I assume I'm about to ask a
pretty stupid question :)
Is there any way in T-SQL to retrieve a list of users who belong to a
particular role? And would this method work if the base method of
authentication was Windows Authentication?
Thanks
Mike.sp_helprolemember <role>
will list out the users within a role.
"Mike Ashton" <MikeAshton@.community.nospam> wrote in message
news:OjTI5PuWFHA.1404@.TK2MSFTNGP09.phx.gbl...
> Since I can't find this information anywhere, I assume I'm about to ask a
> pretty stupid question :)
> Is there any way in T-SQL to retrieve a list of users who belong to a
> particular role? And would this method work if the base method of
> authentication was Windows Authentication?
> Thanks
> Mike.
>|||It's
EXEC sp_helprolemember '<role name>'
for database roles
and
EXEC sp_helpsrvrolemember '<role name>'
for fixed server roles.
Jacco Schalkwijk
SQL Server MVP
"Mike Ashton" <MikeAshton@.community.nospam> wrote in message
news:OjTI5PuWFHA.1404@.TK2MSFTNGP09.phx.gbl...
> Since I can't find this information anywhere, I assume I'm about to ask a
> pretty stupid question :)
> Is there any way in T-SQL to retrieve a list of users who belong to a
> particular role? And would this method work if the base method of
> authentication was Windows Authentication?
> Thanks
> Mike.
>

Saturday, February 25, 2012

Retrieve length of image or BLOB

I use the data type image to store BLOB's on the database. Now I would
like to Query the length of the BLOB with T-SQL to calculate the used
disk-space for this item.
Has some one a good idea?Check out the DATALENGTH function.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<jehle@.centralnet.ch> wrote in message news:1151484946.825820.229140@.x69g2000cwx.googlegroups.com...
>I use the data type image to store BLOB's on the database. Now I would
> like to Query the length of the BLOB with T-SQL to calculate the used
> disk-space for this item.
> Has some one a good idea?
>

Retrieve GUID or SID FROM Active Directory via ADSI and T-SQL only?

Hi all,

is there a way to get an object's SID or GUID using T-SQL only?

Up to now I got the following code of Active Directory Service Interfaces working,

but GUID or SID are not among the parameters known to me.

Code Snippet

EXEC sp_addlinkedserver 'ADSI', 'Active Directory Service Interfaces', 'ADSDSOObject', 'adsdatasource'

SELECT * FROM OpenQuery(ADSI, 'SELECT title, displayName, sAMAccountName, givenName, telephoneNumber, facsimileTelephoneNumber, sn FROM ''LDAP://DC=whatever,DC=domain,DC=org'' where objectClass = ''User''')

I do not want to use anything other then SQL Server 2000 to get an AD-object's primary key.

Any comments would be appreciated.

Thank you!

Regards,

caracol

Windows 2000 Server, SQL Server 2000, AD in W2K only mode

This is not an SSIS question. Moving to the Transact-SQL Forum.|||

Hi all,

just in case there should be someone else looking for identifiable data to be extracted from Active Directory:

A complete list with all attributes can be found at

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adschema/adschema/attributes_all.asp

For every attribute the LDAP-Display-Name is given which can be accessed by ADSI.

My SELECT from above should be

Code Snippet

SELECT * FROM OpenQuery(ADSI, 'SELECT objectGUID, title, displayName, sAMAccountName, givenName, telephoneNumber, facsimileTelephoneNumber, sn FROM ''LDAP://DC=whatever,DC=domain,DC=org'' where objectClass = ''User''')

then.

Regards,

caracol