Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Mark Easton

« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS 

Search for specific text in all stored procedures

declare @search varchar(50)
SET @search = 'searchterm'

SELECT    
     ROUTINE_NAME,
     ROUTINE_DEFINITION
FROM    
    INFORMATION_SCHEMA.ROUTINES
WHERE    
    ROUTINE_DEFINITION LIKE @search
ORDER BY
    ROUTINE_NAME

Connection To Active Directory From SQL Server

SQL Code to link to active directory from within SQl Server.
ound by searching through a forum so can't claim I thought of it

//Follow this syntax:
EXEC master.dbo.sp_addlinkedserver @server = N'ADSI',
@srvproduct=N'Active Directory Services', @provider=N'ADsDSOObject',
@datasrc=N'Servername.domain.com'  --AKA the full computer name of the AD server

//Then execute the openquery like this:

select * from openquery
(
ADSI,'SELECT name
FROM ''LDAP://Servername.domain.com''
WHERE objectCategory = ''Person'' AND objectClass = ''user''
')
« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS