Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Stored Proc Contents Missing

Posted on 2008-10-16
13
Medium Priority
?
279 Views
Last Modified: 2012-08-13
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
Comment
Question by:H-SC
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
13 Comments
 
LVL 15

Accepted Solution

by:
jorge_toriz earned 2000 total points
ID: 22732172
mmm... nop, somebody deleted your code... sorry... it just not happens.   SQL Server didn't make that
0
 
LVL 1

Author Comment

by:H-SC
ID: 22732297
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
 
LVL 15

Expert Comment

by:jorge_toriz
ID: 22732351
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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 1

Author Comment

by:H-SC
ID: 22732392
yes this is all that I see when I request modify script.
0
 
LVL 15

Expert Comment

by:jorge_toriz
ID: 22732410
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
 
LVL 13

Expert Comment

by:AielloJ
ID: 22732421
Does any other user have privileges to create or modify stored procedures in your database or schema?
0
 
LVL 1

Author Comment

by:H-SC
ID: 22732455
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
 
LVL 15

Expert Comment

by:jorge_toriz
ID: 22732496
Well.. the modified date is just lower that the time you have encountered problems?
0
 
LVL 1

Author Comment

by:H-SC
ID: 22732525
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
 
LVL 15

Expert Comment

by:jorge_toriz
ID: 22732587
Soooo weird... this date (modify_date) in sys.objects view only updates when you modify the structure of your object
0
 
LVL 1

Author Comment

by:H-SC
ID: 22732652
oh well, looks like I am going to be re-typing my sql!

many thanks for your time
0
 
LVL 15

Expert Comment

by:jorge_toriz
ID: 22732701
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
 
LVL 1

Author Comment

by:H-SC
ID: 22732722
ok will do that.

many thanks again for your suggestions
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question