Cannot execute stored procedure

I created a stored procedure and see it in the node stored procedure, but when I tried to execute it, no procedure was found.

In the node stored procedure, it is called dbo.CopyTable

exec CopyTable 

CopyTable undefined in red if it does not exist. Why?

Even if I right-click on the procedure and tell <script stored procedure how to execute, the code that it creates is underlined in red and cannot find the stored procedure.

+4
source share
4 answers

Verify that the selected database contains the CopyTable stored procedure CopyTable

 USE YourDatabase EXEC CopyTable 
+3
source

Try adding dbo and choosing the right database,

 USE databaseName GO EXEC dbo.CopyTable GO 
0
source

Most likely, you are in the wrong database in the query window, you can specify the database as follows:

 EXEC [yourDBName].dbo.CopyTable 

Read on how to execute a stored procedure

Given your updated question:

Even if I touch the procedure correctly and tell the script the stored procedure how to execute, the code it generates is underlined in red and tends to find the stored procedure.

This can happen if your stored procedure is invalid. Please double check the correctness of SPROC and make sure that there are tables that are referenced, etc.

0
source

Try performing CREATE PROCEDURE. Select it, f5 it, and then make sure that it works before you access it elsewhere.

0
source

All Articles