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.

3
  • 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. Commented Jul 11, 2012 at 0:43
  • Yeah, im still in design stage so I may do this.. I was just going for the easier option Commented Jul 11, 2012 at 2:07
  • ive outlined my reasoning for why i didnt plan on doing that here: stackoverflow.com/questions/11426012/… main reason is im worried it'll generate too many querys. Commented Jul 11, 2012 at 23:52

1 Answer 1

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?

Sign up to request clarification or add additional context in comments.

1 Comment

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.