Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stored procedure doesn't show code in database

I am having a weird problem. I have created a stored procedure and executed it successfully.

But when I try to look for it in the database, it doesn't show the code inside the procedure. I mean if I right click and say modify to see my procedure's code, it shows only following code :

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

ALTER PROCEDURE Proc_Name

Why its not showing the complete code? I deleted the procedure from database and again executed then it says "There is already an object named 'Proc_Name'in the database." and it shows the same code.

like image 321
Programmer Avatar asked May 19 '26 02:05

Programmer


1 Answers

If right-click - Modify does not show the text of the stored procedure, try the following:

SELECT text 
FROM syscomments 
WHERE id = (SELECT id FROM sysobjects WHERE name = 'proc_name') 

Replace proc_name with the name of the stored procedure in question.

If that works, I would think about re-creating it using a standard template, like the one you get when you right-click Stored Procedures - New Stored Procedure, and cleaning up any odd formatting.

like image 57
chase huber Avatar answered May 21 '26 14:05

chase huber



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!