T-SQL: only run job on primary node
If sys.fn_hadr_is_primary_replica ( 'CC_DLL' ) <> 1 BEGIN -- This is not the primary replica, exit without error. print 'Secondary node' END -- This is the primary replica, continue to run the job... else begin YOURACTIONS end