Database trigger and there is login fail on the sql errorlog

sakuraime 2,326 Reputation points
2020-08-18T04:18:24.463+00:00

I have the following trigger database trigger 18167-trigger.jpg

and then there is a error in the errorlog
18221-trigger-login.jpg

why is that ?

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,788 questions
{count} votes

8 answers

Sort by: Most helpful
  1. Shashank Singh 6,251 Reputation points
    2020-08-18T07:17:31.647+00:00

    The login failed message is not related to the trigger both are mutually exclusive events. The reason for login failure is that the login which you are using is not present in the SQL Server logins. May be it was removed. Please check

    0 comments No comments

  2. tibor_karaszi@hotmail.com 4,311 Reputation points
    2020-08-18T07:18:51.467+00:00

    These are most likely not related. The trigger should not generate such a message in the errorlog. Can you pose a full repro (T-SQL we can execute which reproduces the situation)?

    0 comments No comments

  3. m 4,271 Reputation points
    2020-08-18T08:46:57.53+00:00

    Hi @ michaelchau,

    Based on the error message, there is no login for the user, so you can try to Create a Login and then use the new log in to alter the trigger again. You can use SSMS to connect from a Windows machine and create a login or do it in T-SQL.

    BR,
    Mia
    If the reply helped, please do “Accept Answer ” and upvote it.--Mia


  4. sakuraime 2,326 Reputation points
    2020-08-21T09:59:51.103+00:00

    but there is no way I need to add this computer account to my sql server

    And once the trigger is triggered, the error appear .

    0 comments No comments

  5. tibor_karaszi@hotmail.com 4,311 Reputation points
    2020-08-21T10:34:28.367+00:00

    So you are absolutely 100% certain that it connects to the trigger? With no doubt, whatsoever?

    If so, I'd open a case to file a bug with MS. I can't imagine how such a trigger can produce that error message, and if it truly does I suspect a bug in the product.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.