Indestructible stored procedure

I want to describe step by step what I want to do, what I am actually doing and what comes out of it in SQLEXPRESS.

I managed to create a few stored procedures. Now I changed my mind on one of them. The idea I tried did not work, period. I want to modify it. The Object Explorer offers me this chance. I go to my database: hist_O for simplicity sake, click Programmability-->Stored Procedures--My Stored Procedure and then say: MODIFY. I see (much hated already) my stored procedure in the lookup window on the right. Its name is CreateTableO. It is not what it is suposed to be and I want to change the content. A sensible way to go about it is perhaps to click Ctrl+Shift+M. I do it and get a parameters window. I see Specify Values For Template Parameters on the top. OK, it is no Template anymore and there are no parameters in the window. The stored procedure does have one parameter which I badly want to kill: @tableName, but it is not there! The whole window is empty and it is white. It does not give me any prompt to Mouse-->RightClick. I cannot type anything in. Ctrl+V does not work, nothing.

I do not give a damn about that parameter either. So I go to File-->Open--> it leads me to a directory where Queries dwell. I do have the stored procedure in there. Not the one I am talking about, one that is in the Object Explorer--NO, but the one I want it to be, the one that actually works for me: it is called Query10. I saved it days ago. I open it up, copy the whole content to Clip, go back to Object Explorer where my much hated stored procedure CreateTableO is, and paste the content of Query10 onto CreateTableO wholesale. Then I execute the store procedure CreateTableO. It has name of the table I want to create alredy built in, the old table is dropped, new one is created. I get a message in the message window: Command(s) completed successfully, thus I hope that this procedure will persist, as Cetin said. The next thing is to save it. The only thing I want to do is to save this stored procedure CreateTableO, nothing else.

I open the dropdown menu at Files and do NOT see my stored procedure I am supposed to save. Instead I see: Save SQLQuery2 or SQLQuery4 or something different. Sometimes I see: Save Solution1. What the hell is Solution1 Why do I need it I am in a business of saving my darn stored procedure. The only option for me to hit save all. It is always there. I do and when this wise system offers me to save SQLQuery4, I direct it in the file select window into saving it as CreateTableO. It has been there as I said. I do not even know what I've saved because I have no idea what SQLQuery4 is. I close the SQL Server Management Studio, open it back up again, go to my stored procedure and find it UNCHAGED! I swear, this system, at least the one I deployed, has a mind of its own and I've been wasting a lot of time trying to understand how to get a hang of it one way or another. I am really desperate. There must be a good Idiot's Guide as to how break into it without going crasy and ending up with a shrink.

I have been trying to modify this procedure for an hour and it is still unchanged as it is.

I go to SQL Server Help, find Solution and get a quote: A solution includes one or more projects, plus files and metadata that help define the solution as a whole.

Very Clear! Remeber, I started out with saving a modified Stored procedure! I am wondering if many other people have much easier time in handling all this I love complicated things but this is almost too much.

Sometimes I cannot even save the "stored procedure" or query as my stored procedure because I get a message that the file is in use. There is no way to disconnect it immediately. Sure, when you open up a file in a Notepad, this file will be in use but you can save it if you modified it. Is it not true

What the hell are Queries Why are there in the first place When I open a completely new template for a stored procedure I can save it to be seen in the Object Explorer. I should say IN MOST CASES. But not always. Something still eludes me at that juncture too. But when I try to modify them they appear to be indestructible and if I started out with a saved Query it will never show up in the Object Explorer tree at that database, no matter what I do. I cannot memorize what Query1,Query2,Query3, etc contain. In some of them there is garbage. I need to do something about it and I do not know what.

Thanks.




Answer this question

Indestructible stored procedure

  • Rickyman45

  • Nelis Bijl

    Alex,

    changing a stored proc is quite easy, just open it with Modify. Change the content of the database (not substituting the variables within the procedure, just the logic you want to change) and hit the Save button the the top iconpane. (Not the save script button !). YOur changes should have been applied then.



    HTH, Jens K. Suessmeyer.

    ---
    http://www.sqlserver2005.de
    ---


  • Jamie Thomson

    Jens K. Suessmeyer wrote:
    Here you are: http://sqlserver2005.de/Screencast/Screencast.aspx ScreencastID=7

    -Jens.

    Very, very good. I would say, fantastic. I gave you a 5. Thank you Jens. If you still need my email address it is in the feedback.

    Thanks.



  • Karl Kelly

    Jens K. Suessmeyer wrote:
    Sorry, I messed up with the VS which acts a bit different, you will have to execute the query (as it states a ALTER procedure). For compensation I created a Screencast dedicated to you which I can send you over if you provide me your mail adress (You can send it via mail to me). As I will be home again, I will put it on my site for the public.

    HTH, Jens K. Suessmeyer.

    ---
    http://www.sqlserver2005.de
    ---

    Thank you Jens,

    The problem is over. As always I have learned everything mechanically, on intuitive level. It is just a matter of learning a strict sequence of about 6-7 operations and executing them without thinking. I cannot even explain now how I did it.

    In truth, there are a few buttons that offer option "execute." Some of them execute query but do not touch the stored procedure, as I understand it. So, when you do that execute, nothing is saved, as far as the stored procedure goes. I do SQLEXEPRESS and this is a stripped down version, so they probably simplified everything to the bone. Ok, there is one place where it says (in the dropdown menu): execute stored procedure. When I found it it did the trick. I had to learn the subtle distinction. And looking back I realize that this makes a lot of sense.

    I am humbled by your dedication. I think I do not deserve it but I will send you my email tomorrow.

    Thanks.



  • Meera V

    Sorry, I messed up with the VS which acts a bit different, you will have to execute the query (as it states a ALTER procedure). For compensation I created a Screencast dedicated to you which I can send you over if you provide me your mail adress (You can send it via mail to me). As I will be home again, I will put it on my site for the public.

    HTH, Jens K. Suessmeyer.

    ---
    http://www.sqlserver2005.de
    ---

  • Amos Soma

    Well, I did it again, about 5 times. All the buttons do not save anything. There is a save all button. not save button. It did not work.

    What could be the reason Shall I reinstall the server

    Thanks.



  • Indestructible stored procedure