Sql-server – How to access a stored procedure on a different database on the same server

sql server

Here is my code

ALTER PROCEDURE [admin].[UpdateMiddleSchoolTranscriptsGPA_weight]
AS
BEGIN
    SET NOCOUNT ON;

    --EXEC webapp.sa.[MMSD].[UpdateMiddleSchoolTranscriptsGPA_weight]

    EXEC MMSD.UpdateMiddleSchoolTranscriptsGPA_weight

END

Im using alter because i already made the existing procedure, i named it admin because i need to call the one from the mmsd database also i need to access it using some php button I wrote. any help would be appreciated

Best Answer

You can address objects in other databases by using three part naming.

Database.Schema.Object

Four part naming adds the ServerName to the start.