SQL Exception when login to Sitecore 9.1
Fix it using an SQL Command

Posted on Wednesday, June 5, 2019

We recently had an issue with Sitecore 9.1 where you could no longer login to sitecore. After you tried to login you saw a white screen with just a text saying An Error occurred

Upon inspecting the logs we noticed an SQL exception:

Nested Exception

    Exception: System.Data.DataException
    Message: Error executing SQL command:  
		INSERT INTO [Properties] (   [Key], [Value] ) VALUES (   @name, @value )

    Nested Exception

    Exception: System.Data.SqlClient.SqlException
    Message: String or binary data would be truncated.
    The statement has been terminated.
    Source: .Net SqlClient Data Provider

After a bit of searching we found the following Stack Exchange article.

We have yet to figure out why this happens. But at least you can login again after running the following SQL Command against the core database.

DELETE FROM [YourCoreDatabase].[dbo].[Properties] WHERE [Key] LIKE 'CORE_SC_TICKET_%'

If we ever find out why this error occurred in the first place, I will update this article.