storing mm/yyyy date format in

Hi, I am storing date formats in month and year only (mm/yyyy).
I am struggling on placing validation for it and storing in the above format. Any suggestion?

thank you
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dsackerContract ERP Admin/ConsultantCommented:
Change it temporarily to "mm/01/yyyy", see if it passes IsDate (or similar) tests, then lose the /01. :)
Mike EghtebasDatabase and Application DeveloperCommented:
Store it as YYYYMMDD in the database but display it any way you want in your screen. It is a bad practice to store date as string.

For example, '20070212' ymd is language-neutral only for the data types DATE, DATETIME2, and DATETIMEOFFSET.
Scott PletcherSenior DBACommented:
Use YYYYMM.  The problems with MM/YYYY are:
1) won't sort correctly
2) wasted space for the '/' -- never store editing chars in the db
3) can't do date math on it; YYYYMM has the same problem, but it's more easily fixed.  If you might need to ever do date math on the value, store it as YYYYMMDD.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PortletPaulEE Topic AdvisorCommented:
Use a date column (storage 3 bytes). You get the needed validation built in, you can sort it, you can do proper date range filters using it and date arithmetic. You can output it as mm/yyyy if you want to.

Just assume the day is always 01
Vitor MontalvãoMSSQL Senior EngineerCommented:
shpresa, do you still need help with this question?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.