Handling Dates while copying from Excel to SQL server database table
Hello,
I am copying data from an Excel workbook to the SQL server database table.
One of the column in my Excel sheet has Dates, which I am generating using Rand function.
If I keep data types of my columns as string in both my Excel input and SQL output.
I get an error which says
"Conversion failed when converting character string to smalldatetime data type."
If I keep my datatypes as Date it gives as error which says
"The cell format is not Date in ....(cell address)"
In my table's definition in SQL server. It has data type as 'smalldatetime'.
So which data types I should assign to my input as well as output to transfer them from Excel to SQL?