Tag Info

Hot answers tagged

3

I am assuming you are trying to implement some basic replication using a trigger. As long as your process remains fairly simple, this should work OK. However, I would advise you to read up on (i.e. google) why executing stored procedures from triggers is not a good idea, and also about SQL's built in transactional replication feature. Here is a practical ...


3

My guess is that your trigger has a "insert into ... select * from myTable" kind of structure, and now it's broken because there's one more column in the table. Change your trigger so that it lists the columns instead of using *.


3

IF @@ROWCOUNT > 0 BEGIN ROLLBACK TRANSACTION; END ELSE BEGIN ... continue ... END


2

I'd put this in a comment but I want to give pictures. My guess is that you are hitting the little green arrow, or DEBUG button Instead of the red exclamation point, or RUN button. It's a fairly common mistake. FYI you can also hit Ctrl-E to "execute" the script or Alt-F5 to "debug" it. The TSQL debugger requires elevated rights (sysadmin if I ...


1

Here's a very quick example that will create a user blat given an existing login blat in all new databases created (this won't work for attach/restore). You could extend this to adding them to roles, granting permissions, even building the list based off of some query from sys.server_principals in master, sys.database_principals in another database, or your ...


1

"Is it possible to do so? The trigger will insert some rows into a unique table that exists only on the slave." yes, you can A lot of warehousing architectures are based on the slave only. The title of your question is wrong. Change replica DB with SLAVE ONLY


1

Based on your comment, the trigger has multiple lines. You need a BEGIN...END block as follows: USE mcet DELIMITER $$ DROP TRIGGER IF EXISTS tg_student_details_insert; CREATE TRIGGER tg_student_details_insert BEFORE INSERT ON student_details FOR EACH ROW BEGIN SET NEW.created_date = NOW(); SET NEW.dobw = date_to_words(NEW.dob); END; DELIMITER ; ...



Only top voted, non community-wiki answers of a minimum length are eligible