I have a stored procedure that needs to look at one of two databases on my Server Instance.
How can I change the code below to allow me to pass in the database name as a variable?
The tables have the same names...
FROM CRMPROD_01.dbo.P_Deals p LEFT JOIN
CRMPROD_01.dbo.P_Events_Table pe ON p.DealID = pe.dealID LEFT JOIN
CRMPROD_01.dbo.P_Events_Table_Types pet ON pe.EventTypeID = pet.EventTypeID