I have the following SQL
BEGIN
DECLARE @UpdateCount int
EXEC (@UpdateSQL)
SET @UpdateCount = @@RowCount
IF (@UpdateCount < 1)
BEGIN
EXEC (@InsertSQL)
END
END
SET NOCOUNT ON;
This lives inside a trigger however it isn't working as I would expect, it updates but doesn't insert, I don't know what I'm missing..
The SQL inside @InsertSQL is fine as well, I've tested this.