Can't find which row is causing conversion error

Posted by Marwan on Stack Overflow See other posts from Stack Overflow or by Marwan
Published on 2010-05-20T06:32:24Z Indexed on 2010/05/20 6:40 UTC
Read the original article Hit count: 301

I have the following table:

CREATE TABLE [dbo].[Accounts1](
    [AccountId] [nvarchar](50) NULL,
    [ExpiryDate] [nvarchar](50) NULL
)

I am trying to convert nvarchar to datetime using this query:

select convert(datetime, expirydate) from accounts

I get this error:

Conversion failed when converting datetime from character string.

The status bar says "2390 rows". I go to rows 2390, 2391 and 2392. There is nothing wrong with the data there. I even try to convert those particular rows and it works. How can I find out which row(s) is causing the conversion error?

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about type-conversion