SQL Server: halt an INSERT in a trigger

I have a trigger FOR INSERT and I need to stop the insertion by raising a error.

RAISERROR

  • T-SQL Get Rows With Similar Company Name Using Levenshtein
  • Setting up AWS RDS MSSQL instance from .bak file
  • Is there a Boolean data type in Microsoft SQL Server like there is in MySQL?
  • Why is ConnectTimeout Ignored In This Case?
  • SQL: Delete all nested self referencing records
  • Get Excel sheet into temp table using a script
  • will show the error message but is there is a way to halt the action any other method without transactions ?

    One Solution collect form web for “SQL Server: halt an INSERT in a trigger”

    You have the trigger in the wrong place.

    You need an INSTEAD OF trigger instead (no pun intended) to control it. A FOR INSERT trigger occurs AFTER the insert, so the horse has long bolted.

    MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.