Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 285
  • Last Modified:

Stored Proc Contents Missing

I created a large stored proc a couple of days ago and it had been running fine and updating my tables as intended.  I noticed this morning, that my data was not being updated via the proc and went into sql 2005 management studio right clicked on the procedure under stored procedures,  .. clicked modify and noticed that the proc had only 10 lines of system generated code with the name of my procedure in it, but none of the sql that I wrote for this procedure.  what has happened, am I missing something???
0
H-SC
Asked:
H-SC
  • 6
  • 6
1 Solution
 
jorge_torizCommented:
mmm... nop, somebody deleted your code... sorry... it just not happens.   SQL Server didn't make that
0
 
H-SCAuthor Commented:
jorge_toriz,
here is what I see when I click modify....  It also will execute successfully

USE [MYDATABASE]
GO
/****** Object:  StoredProcedure [dbo].[MYSP]    Script Date: 10/16/2008 11:16:40 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[MYSP]
as
set nocount off
0
 
jorge_torizCommented:
Let me clarify my ideas... did your stored procedure code gone away?... is that the only code that you see when you request a modify script?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
H-SCAuthor Commented:
yes this is all that I see when I request modify script.
0
 
jorge_torizCommented:
Check this query to see the last time your stored procedure was modified:

SELECT name, create_date, modify_date
FROM sys.objects WHERE name = 'your_stored_procedure_name'
0
 
AielloJCommented:
Does any other user have privileges to create or modify stored procedures in your database or schema?
0
 
H-SCAuthor Commented:
It has a create date of 2008-10-14 15:53:15.527
and modified date of 2008-10-16 11:32:19.167
0
 
jorge_torizCommented:
Well.. the modified date is just lower that the time you have encountered problems?
0
 
H-SCAuthor Commented:
I noticed that as well.  When I have the sp open and click on execute it updates the modified date that is probably the reason.  I ran the sp in its current condition and it updated the modified date
0
 
jorge_torizCommented:
Soooo weird... this date (modify_date) in sys.objects view only updates when you modify the structure of your object
0
 
H-SCAuthor Commented:
oh well, looks like I am going to be re-typing my sql!

many thanks for your time
0
 
jorge_torizCommented:
Yep, somebody modified your stored procedure... I can bet for that

Implement a DLL Trigger to audit your changes, catch the group DDL_DATABASE_LEVEL_EVENTS
0
 
H-SCAuthor Commented:
ok will do that.

many thanks again for your suggestions
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 6
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now