Scripts

Technical Article

Extract values from a string using a delimiter

There are many occasions in programs where you need to manipulate strings of characters that are delimited by a particular character, such as a comma, or a space. This function enables you to extract a substring from the string at a specified occurence of the delimter. declare @Data varchar(255) set @Data = 'A,B,C,D,E' print dbo.field(@data,',',2,2) […]

(6)

You rated this post out of 5. Change rating

2011-11-28 (first published: )

2,627 reads

Technical Article

Extract More Than 1000 Active Directory Accounts

This is a simple method to load a SQL database with active directory account information without running into the 1000 record limit.  You will need to change the SERVERNAME, PORT, DATABASENAME, USERID, AND PASSWORD values in the connection strings to your own values.  You will also need to change the LDAP connection string values ('LDAP://SERVERNAME/ou=OUName,dc=host,dc=domain,dc=tld') […]

(2)

You rated this post out of 5. Change rating

2011-11-21 (first published: )

2,825 reads

Blogs

KDA: Echoes of Deception - Case 6

By

A cryptic message, a book cipher hidden in art provenance records, and a trail...

Capturing My Own Metrics: #SQLNewBlogger

By

A customer was trying to compare two tables and capture a state as a...

Red Flags in Your Query (T-SQL Tuesday #200)

By

When I'm looking at a query, I bet it's bad if I see... a...

Read the latest Blogs

Forums

BIT_COUNT II

By Steve Jones - SSC Editor

Comments posted to this topic are about the item BIT_COUNT II

I Can't Make You Learn

By Steve Jones - SSC Editor

Comments posted to this topic are about the item I Can't Make You Learn

Why Your SQL Permissions Disappeared

By deepeshdhake

Comments posted to this topic are about the item Why Your SQL Permissions Disappeared

Visit the forum

Question of the Day

BIT_COUNT II

In SQL Server 2025, I have a table (dbo.UserPermission) that contains this data:

UserID  UserPermissions
15
23
37
4       NULL
What is returned when I run this code:
select bit_count(UserPermissions) as PermissionCount
from dbo.UserPermission
where UserID = 4;

See possible answers