TablePlus / TablePlus-Windows

TablePlus Windows issue tracker
https://tableplus.com
187 stars 3 forks source link

The conversion of a varchar data type to datetime data type resulted in an out-of-range value #335

Open Toadie1 opened 3 years ago

Toadie1 commented 3 years ago
  1. Which driver are you using and version of it (Ex: PostgreSQL 10.0): MS SQL 2017

  2. Which TablePlus build number are you using (the number on the welcome screen, Ex: build 81): Build 148

  3. The steps to reproduce this issue: Open table containinf datetime column. Make some changes on any another column and try to save changes. The error: The conversion of a varchar data type to datetime data type resulted in an out-of-range value. The statement has been terminated.

The screens will be more descriptive.

Výstřižek1 Výstřižek2
Toadie1 commented 3 years ago

Generated UPDATE query: -- 2020-12-02 01:11:27.1281 BEGIN

-- 2020-12-02 01:11:27.1404 UPDATE [dbo].[CenikPolozky] SET [Cena] = '1411', [EshopRequest] = '1' WHERE [IdCeniku] = 'ADP' AND [IdZbozi] = 'TZ2890153' AND [PlatnostOd] IS NULL AND [PlatnostDo] IS NULL AND [MinLimitZasoby] = '60' AND [Cena] = '1410' AND [AkcniMnozstvi] = '0' AND [AkcniCena] = '0' AND [DatumZmeny] = '24.11.2020 14:00:49' AND [MagisExportStatus] = '0' AND [EshopRequest] = '0' AND [EshopResponse] = '0';

-- 2020-12-02 01:11:27.1522 ROLLBACK;

huyphams commented 3 years ago

Hi @Toadie1 I don't think this issue is related to TablePlus (TablePlus sent the query to the server and the server returned that error). It could be an invalid date format, please try again with a valid date format.

Toadie1 commented 3 years ago

Hi @huyphams As I described above. I open table, made some change (seen on first image), but I didn't touch the stored DateTime value and try to commit the transaction. The SQL query generated from UI has invalid DateTime format for MS SQL. DateTime format in WHERE condition should be ISO format '20201124 14:00:49' or '2020-11-24 14:00:49', but I never seen '24.11.2020 14:00:49' (dot as separators of date parts).