locked
"Script Table As" Errors: Returns structure for wrong table, etc. RRS feed

  • Question

  • Hello, all.

    A few weeks ago I ran "Script Table As" for "SELECT TO..." and it returned the data structure for the wrong table!

    I restored the database from a known good backup from months before, and the same thing happened. I nearly resorted to restoring the Master database from backup, when the phenomenon suddenly disappeared.

    Now this morning, I ran "script table as" on a different table (And different database as well) and it only returned part of the structure.

    Any ideas? Is my master database corrupted? Queries, etc. seem to work normally.


    • Edited by AlHoward Monday, June 16, 2014 2:20 PM
    • Moved by Olaf HelperMVP Friday, June 27, 2014 5:16 PM Moved from "SQL Database Engine" to a more specific forum
    Monday, June 16, 2014 2:18 PM

Answers

  • Hello,

    SSMS is the one who generates that scripts, not the SQL Server Database Engine. Restoring any database won't change anything on the behaviour of Tools like SSMS.

    Instead you should apply the last Service pack for SQL Server also on your client machine, may the issue is already fixed in the SP.


    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    Monday, June 16, 2014 2:26 PM
  • I don't know what is going on, but I would definitely run a trace to see what statements SSMS is emitting. If you see the wrong table names listed in the query, you know that SSMS is confused. If you see the right table name, and wrong data comes back, you have a real problem. (I would place my bets on the first alternative.)


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
    Tuesday, June 17, 2014 9:32 PM

All replies

  • Hello,

    SSMS is the one who generates that scripts, not the SQL Server Database Engine. Restoring any database won't change anything on the behaviour of Tools like SSMS.

    Instead you should apply the last Service pack for SQL Server also on your client machine, may the issue is already fixed in the SP.


    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    Monday, June 16, 2014 2:26 PM
  • Thank you very much, Olaf.

    It is comforting to know it is not corrupted data!

    I am having a dickens of a time trying to find the latest patch. My database engine is already SP3.

    Microsoft SQL Server 2008 (SP3) - 10.0.5512.0 (X64)

    Tuesday, June 17, 2014 3:15 PM
  • My database engine is already SP3.


    And what about your Client machine with the tool SSMS, have you installed SP3 as well? Again, the tool generates the script, not the database engine.

    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    Tuesday, June 17, 2014 3:19 PM
  • It started on the server itself: version 10.0.5512.0

    My desktop is 10.0.5500.0 where it started happening yesterday.

    I still cannot find where to download or verify I have the latest version of SSMS.

    Windows Update comes up with nothing, and Google just comes up with a bunch of dead-end rabbit holes.

    Tuesday, June 17, 2014 3:53 PM
  • I don't know what is going on, but I would definitely run a trace to see what statements SSMS is emitting. If you see the wrong table names listed in the query, you know that SSMS is confused. If you see the right table name, and wrong data comes back, you have a real problem. (I would place my bets on the first alternative.)


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
    Tuesday, June 17, 2014 9:32 PM
  • Of course now that I ran a trace, it won't duplicate. If it pops up again, I'll update this ticket.

    Thanks to both of you.

    Wednesday, June 18, 2014 1:05 PM