samedi 9 juillet 2016

The conversion of a nvarchar data type to a datetime, data type resulted in an out-of-range value

Runtime exception:

The conversion of a nvarchar data type to a datetime data type resulted in an out-of-range value.

Code:

INSERT INTO [Migrated].[dbo].[MyTables] (LegacyId,DeedDate)
    SELECT DISTINCT 
        a.[IPLID], CONVERT(nvarchar(255), a.[Deeddate], 127) 
    FROM 
        [Legacy].[dbo].[MyTables2] as a
  • MyTables --> DeedDate datetime Allow Null
  • MyTables2 --> Deeddate nvarchar(255) Allow Null

Hope I have done it correctly. But why it gives above error ?

I'm using SQL Server 2014 express.

Note : Can you tell me how to find out defects on MyTables2 Deeddate ? I mean different date formats and etc.Or Replace such dates with NULL.

Aucun commentaire:

Enregistrer un commentaire