0

I have a table that holds PDF's with meta data, it also has 10 anonymous rows in it. These rows can be used to hold any C# Data Type as each user may use it for a different reason.

There are a standard set of information on each record, for example PDF Path Data, Description, etc. And then 10 rows called "Key1, key2, key3". The reason for these is the user can rename them on my webpage and store their own data to do with the uploaded PDF File. (They may have information like Customer Name, Publisher Name, Cost, ect)

I want to keep these values open to almost any data type..

The question I have, is what SQL datatype should I use? I dont mind having a Character Limit.. But I need to know the most efficient way to store it.. It would be simple to just do Varchar(100) and convert the value in c# as required.

Michael
  • 8,229
  • 20
  • 61
  • 113
  • 1
    Off topic but you should normalize your data model, instead of having "key1" ... "key 10" you could have a table called Keys with a foreign key to your pdfs table that way you can have 1...n "keys" and they can be named descriptively. – shuniar Jul 11 '12 at 00:43
  • Yeah, im still in design stage so I may do this.. I was just going for the easier option – Michael Jul 11 '12 at 02:07
  • ive outlined my reasoning for why i didnt plan on doing that here: http://stackoverflow.com/questions/11426012/dynamically-creating-gridview main reason is im worried it'll generate too many querys. – Michael Jul 11 '12 at 23:52

1 Answers1

1

If you don't mind having a character limit, use varchar.

For reasons why it's better than nvarchar, see What are the main performance differences between varchar and nvarchar SQL Server data types?

Community
  • 1
  • 1
mnsr
  • 12,337
  • 4
  • 53
  • 79
  • thanks but from that page it seems varchar may be a better option :) It will never be a multi-lingual sitem and varchar has better performance – Michael Jul 10 '12 at 23:36