Reputation: 1013
I'm trying to add a comma delimited string into a column in my table set to INT. I used it to reference a Category ID but now I'd like the possibility to add more than just 1 category.
Thinking I could accomplish this by entering a string like: 1,2,3 instead of just 1 but i'm getting errors that the changed value in this cell was not recognized as valid.
Does this mean I need to change that column to VARCHAR instead of INT?
Upvotes: 0
Views: 525
Reputation: 1269973
No, this means that you should set up proper tables to support a 1-many relationship. That is, you want a separate table, not a bogus data representation in a varchar column.
Why? Well, SQL has this great data structure for lists, called a table. In addition:
Upvotes: 7