December 11, 2014 at 5:51 am
I need to save a serial number.
The serial number consist of a date and a sequential number, e. g. ddmmyy######, 111214000001.
Is it a good idea to also have a date field where I save the same date that is in the serial number?
I will create about 50000 records a day and it should be saved for at least a year.
The database will be used to find a specific serial number and "show" all serial numbers for that day.
// Anders
December 11, 2014 at 8:26 am
Yes. You're going to want to have that date value as a date. Otherwise, you'll have to parse that string and it will prevent index and statistics use leading to very poor performance.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
December 11, 2014 at 8:32 am
You will need to have a date field if you are going to query by date. Well, do it easily anyway. You could write a query to pull the date back out of the serial number then convert it back into a date but what a pain. If there is no overwhelming reason not to add the date field, I'd just add it.
December 11, 2014 at 9:06 am
Thanks for the answers (or maybe the confirmations). I guessed that it would be a good thing!
// Anders
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply