Fix SQL Exception when login to sitecore 9.1
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_%'