user5513578
user5513578

Reputation: 87

How to create synonym for stored procedure with parameters

I run some stored procedures with the same parameters on a consistent basis in SQL Server 2017. I wanted to know how to create a synonym for a stored procedure with hard-coded parameters. For simplistic example, I have this stored procedure with these parameters:

EXEC xp_readerrorlog 0, 1, N'Server is listening on '

I want to know how I can create a synonym for this entire statement. Thank you.

Upvotes: 1

Views: 1323

Answers (1)

Sean Lange
Sean Lange

Reputation: 33571

You can't do that with a synonym. But nothing says you can't create your own procedure.

create procedure MyLogReader as
    set nocount on;
    EXEC xp_readerrorlog 0,1,N'Server is listening on ';

Upvotes: 6

Related Questions