Convert 'short date' to 'long date'

you might think it's stupid question but I thought I would have asked anyway.  I have a table that has a field calls dateEnter was designed as DateTime type (mm/dd/yyyy hh:mm:ss) but my date comes in as varchar (short date - m/yyyy).  
Is there a way to convert a short date (mm/yyyy) to long date (datetime type) in order to write it to the database table without having to add a specific 'dd' value to it.

Thank you for your help with this.
Who is Participating?
jamesguConnect With a Mentor Commented:
you may have to add a specific day such as '01' to it, or change the table schema
Kevin CrossChief Technology OfficerCommented:
Don't believe you can do this without putting in a day.

Can either generate day as today OR hardcoded value for day in month you want like '01'.
DECLARE @shortdate varchar(7)
SET @shortdate = '10/2008'
SELECT CAST(REPLACE(@shortdate, '/', '/' + str(day(getdate())) + '/') AS datetime) AS LongDate

Open in new window

Kevin CrossChief Technology OfficerCommented:
@james, sorry didn't see your post.
BostCeltAuthor Commented:
That is what I thought too.
All Courses

From novice to tech pro — start learning today.