I am new to SQL & I wonder if anybody can help me with this issue.I am trying to run the following query but it keeps on failing with the Msg 102, Level 15, State 1, Line 12Incorrect syntax near 'dbo'.DECLARE @Role NVARCHAR(120);SELECT @Role = ars.role_descFROM sys.availability_replicas arJOIN sys.dm_hadr_availability_replica_states ars ON ar.replica_id = ars.replica_idJOIN sys.availability_groups ag ON ars.group_id = ag.group_idWHERE ag.name = 'ETHIXAG1'AND ars.is_local = 1;IF @Role = 'PRIMARY'BEGIN;dbo.report_stale_open_teller_countEND;But if I run “dbo.report_stale_open_teller_count” separately, it works fine.How can I make the first query run successfully?
↧






