SQL Server procedure- Strange problem

  • Hi

    Have seen some strange problem

    Environment: SQL Server 2005 SP3 on Windows 2003 standard edition

    A developer had made a procedure which contains update for table: mytable..

    Now when he scripts the procedure from Management studio to new query window, along with the procedure script comes create table script for table mytable.

    When modify option is selected, script of procedure is accompanied by alter table add FK .. script.

    The developer has SQL server express tools.

    When I try to connect from my management studio and carry same function on same server I get correct result (no create table/alter table script, only procedure script)

    I have dev edition of SQL Server 2005.

    I have checked on developers machine that no special settings are configured

    And the funniest is, this behavior is shown only for 1 procedure while other procedure works well

    Any clue of why this could happen?

  • Check for the properties of the table if foreign key has been added to MYTABLE..

    If yes, Go to tools -> options -> Designer - > table and database designers and in table designer uncheck "auto generate change script".

    That maybe cusing problem.

    hope it helps.

    No it wont.

  • Interesting. Under the covers when you right-click an object and generate script I SMSS probably takes the object_id and passes it to some internal generate-script procedure together with parameters of 'create', 'alter',... and 'new window', 'clipboard',... etc

    My first idea is that one of your SMSS views was out of sync - doing a refresh should cure that.

    I also thought it would be really interesting to find this underlying procedure and hack it (you can tell its Friday afternoon)

    So I ran a profile trace while scripting an object - and its not that simple - there are some really complex statements running, but profiler does not show up the full extent of what is happening. There must a controlling program querying the database - not just a simple procedure call - You could compare the profiler output of when each machine does the scripting and it might give a clue as to whats going on under the surface.

  • Chandrakant_gaurav, yes, all the other tools options have been explored.

    Tom, its a good idea and try my hand on this. will surely keep you posted for the results

  • i believe the setting "Generate Scripts For Dependant Objects" is True on one machine, but not the other.

    Tools>>Options in SSMS, then you have to find the node "SQL Server Object Explorer">>"Scripting"

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 5 posts - 1 through 4 (of 4 total)

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