I just transferred one of my pages to a Windows Azure Account. Everything went smooth .. until I tried to create some data. My trigger, which worked fine with MSSQL2008 fails on azure - how could I fix this trigger:
CREATE TRIGGER creator
ON someTable
FOR INSERT
AS
DECLARE @someTableID INT;
SELECT @someTableID=(SELECT someTableID FROM INSERTED)
INSERT INTO Preisgruppe ( Name, someTableID, UserPreisgruppe_ID ) VALUES ( 'Gast', @someTableID, 1)
INSERT INTO Oeffnungszeit ( someTableID, Tag_ID, von,bis) VALUES ( @someTableID, 0, '00:00','00:00'),( @someTableID, 1, '00:00','00:00'),( @someTableID, 2, '00:00','00:00'),( @someTableID, 3, '00:00','00:00'),( @someTableID, 4, '00:00','00:00'),( @someTableID, 5, '00:00','00:00'),( @someTableID, 6, '00:00','00:00')
GO
Nothing is looking bad in this Trigger. I did try your code and it's working fine. So it could be the structure. My look like this:
Also it could be nice to have the Error message...
Just to provide another example, here is what I use...
TABLE DEFINITION:
This is just a normal table except the "main body" of AUDIT fields are in the HISTORY table.
On a side-note...
HISTORY TABLE DEFINITION (used for audit purposes):
This table is used for AUDIT purposes. You still get to see who did what & when, except now, the history isn't buried in your main table and won't slow-down your INDEXES. And...you get TRUE AUDIT beyond that of mere log-shipping.
On a side-note...
TABLE TRIGGER:
Just a normal trigger...