Monday, September 21, 2026

How to Fix Excel Dates Copying Incorrectly into SSMS (SQL Server Management Studio)

 If you have ever tried copying date cells straight from Excel into SQL Server Management Studio (SSMS) and ended up with weird numbers or import errors, you are not alone.

When you copy standard date cells, Excel places both the formatted view and the raw serial number onto your system clipboard. SSMS often captures that raw serial number instead of the actual date string, causing formatting conflicts.

Here is a quick, foolproof workaround to ensure your dates paste correctly every single time.

The Solution: Use Excel's TEXT Function

To force SSMS to accept your data as a proper date during a direct copy-and-paste, you need to convert the dates into a clean text format in Excel first.

  1. Create a temporary helper column next to your original data. Use the TEXT function to convert the date into standard ISO format (YYYY-MM-DD). For example, if your original date is in cell A2, enter this formula in your helper column:

Excel
=TEXT(A2, "yyyy-mm-dd")
Drag this formula down for all rows, then copy these new text-formatted values (and **Copy > Paste Values** if you want to strip the formulas).


2. Verify the destination column type:
In SQL Server Management Studio, make sure the target column type is explicitly set to `DATE` or `DATETIME` (and not `INT` or `FLOAT`). If the column is numeric, SSMS will force the pasted text back into a number.


3. Paste the data into the SSMS grid:
  •  Right-click your table in SSMS and select **Edit Top 200 Rows**.
  • Scroll down to the bottom, empty row marked with an asterisk (`*`).
  • Click the row selector header on the far left, and press `Ctrl + V` to paste.

Verification: Click away from the pasted row to commit the changes. The dates should save successfully as `YYYY-MM-DD` calendar dates instead of numbers.

Cheers,
Samitha

No comments:

Post a Comment