troubleshooting Question

How to set up multiple categories in MS SQL Server?

Avatar of jumpseatnews
jumpseatnews asked on
Microsoft SQL ServerASP.NETMicrosoft SQL Server 2005
7 Comments1 Solution237 ViewsLast Modified:
This may be a simple question, so forgive me in advance, but how do you assign multiple categories in a single field for SQL Server data?

Example, I have in one table:
ID, int (PK)
FirstName, varchar
LastName, varchar
EmployeeNumber, int
DatePosted, smalldatetime
CategoryID, int  (FK to a CategoryID table)

Then, in the other CategoryID table, I have:
CategoryID, int (PK)
Category, varchar

How do I assign on record in the first table to have multiple categories associated with it?

Thus, say the record is:
[here i want to have 'Admin, User, Writer' in associated to this.

The other table would be:
1  Admin
2  User
3  Power User
4  Writer
5  Author

Do I just put 1,2,4 in the one area?  I'm sure there is an easy methodology for this, but I'm not getting the best way tot do this without having to crate a boolian set of columns for each category in the primary table.

This data will eventually be used to display on an ASP.NET page.

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 7 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros