Working on stored procedures

  • Thanks for your response, Hugo.

    Hugo Kornelis (8/27/2012)


    sam.dahl (8/26/2012)


    ... but I tend to disregard linguistic errors if the intent is obvious. ("If I execute both scripts seperately")

    In short, I don't do alot of work with stored procedures and it shows here in that it wasn't immediately obvious to me why the quote was significant.

    Are you sure you didn't overlook something when testing this on your database?

    Anyway, I had another go at it and got the expected result.

    My conclusion is that I must have done something out of order the first time around. Given that I didn't initially understand what the question was testing I must have created the table after the stored procs.

    A lesson hard learned is not a lesson soon forgotten. 😉

  • Nice question, I knew that one from experience :blush:

  • Yes both script execute successfully, using SQL server version 9.0.5000 [Sql server 2005]

    With "Command(s) completed successfully".

  • udayroy15 (8/29/2012)


    Yes both script execute successfully, using SQL server version 9.0.5000 [Sql server 2005]

    With "Command(s) completed successfully".

    Did you have the tables set up as described in the question text?


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/

  • mbova407 (8/28/2012)


    Nice question, I knew that one from experience :blush:

    +1

    Thanks for the good question.

    _____________________________________________________________________
    [font="Comic Sans MS"]"The difficult tasks we do immediately, the impossible takes a little longer"[/font]

  • means, i have to create table first then to execute the mentioned statement...........

  • I tested this in SQL Server, which I think you would agree is the ultimate arbiter here. I executed each statement separately. In both cases, I received "Command(s) completed successfully". Practically speaking and linguistic matters aside, this is the real answer.

  • t_a_dunn (8/31/2012)


    I tested this in SQL Server, which I think you would agree is the ultimate arbiter here. I executed each statement separately. In both cases, I received "Command(s) completed successfully". Practically speaking and linguistic matters aside, this is the real answer.

    Did you create the table as requested in the question?

    Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]

  • Ah! Good point. Thanks.

  • Nice straightforward question.

    More like this one needed, judging by the number who got it wrong.

    Tom

  • Hi,

    For me , both stored procedures were created successfully. I dint get any errors. I am using sql server 2008 R2. why is that??

  • For me, both stored procs were created successfully. Why is that??

    Anju Renjith

  • mailtoanjue (9/6/2012)


    Hi,

    For me , both stored procedures were created successfully. I dint get any errors. I am using sql server 2008 R2. why is that??

    It's clear from the screen shot that you didn't follow the instructions, because both tables are there in the object list and the question clearly says that the SP scripts are to be run against a db in which one of them doesn't exists. My guess is that you also had both rows in both tables, agfain contrary to the question which requires the table that does exist to have only one of the rows the SP refers to. So both SPs were created OK, one which shouldn't habve compiles compiled because you failed to follow the instructions, and one one which shouldn't have compiled despite your failure to follow the instructions.

    Tom

Viewing 13 posts - 31 through 42 (of 42 total)

You must be logged in to reply to this topic. Login to reply