Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL to List Matching ACL 1

Status
Not open for further replies.

Michael42

Programmer
Oct 8, 2001
1,454
US
Hello,

With standard ANSI SQL, I have an application whose business rules dictated that an ACL (Access Control List) is kept for evey record. This list will control whether or not a record is listed in a SELECT etc.
Code:
[b][COLOR=blue]Table: Files[/color][/b]
id      (Number)
title   (Text)
detail  (Text)
acl (Text: comma delimited list of userID's that can access file)

If a user is logged in and I know their userID (say 1001) what would be the SELECT statment on the above table to ensure only records that contain the user's userID are listed when I do a SELECT?

This has stumped me - thanks for your help,

Michael42
 
You probably need a WHERE clause along the lines of
Code:
WHERE ("," & [acl] & ",") LIKE "%,1001,%"
Assuming that there are no spaces before or after the commas in [acl].
 
Golom,

That was perfect! :)

Thanks for taking the time to post.

-Michael42
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top