HiveBrain v1.2.0
Get Started
← Back to all entries
patternModerate

Can I give the same name to a table and a stored procedure?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
storedcanthesamegiveprocedurenameandtable

Problem

Is it possible to name a stored procedure the same as a table? I have an existing table named 'buyers', and I'm trying to create a stored procedure named 'buyers', but I'm getting this error:


There is already an object named 'buyers' in the database.

Solution

No. This is clearly stated in the MSDN documentation:


Procedure names must comply with the rules for identifiers and must be
unique within the schema.

Since you have a table with the same name, in that schema, you cannot create the stored procedure with that name.

Context

StackExchange Database Administrators Q#48051, answer score: 10

Revisions (0)

No revisions yet.