3

SQL Server Management Studio sits stuck, after scripting all objects in a database. Except it didn't script all objects in a database.

i scripted all the objects in an SQL Server 2008 database from SQL Server Management Studio (three times):

enter image description here

And it says it scripted all the objects, except it never actually completes - sitting there stuck:

enter image description here

It does manage to script three objects:

enter image description here

But not all the objects.

You'll notice:

  • the UI says it sucessfully scripted all 189 objects
  • the UI is stuck; the Close button is disabled
  • the folder that contains the "successfully" scripted database objects doesn't contain all the successfully scripted database objects.

Which begs the question:

How do i script the objects of an SQL Server 2008 databasein SSMS?

Update: It can script any VIEW, STORED PROCEDURE, or FUNCTION, without issue. But if i choose to script just the first table, it fails:

enter image description here

It also fails if i script tables:

  • A - M
  • O - Z
  • A - G

This never-ending bug was the reason we bought SQL Compare four years ago; you couldn't trust Microsoft's tool to script a database correctly (silently omitting tables).

Update: Scripting options

Here's the set of scripting options in use

  • ANSI Padding: True
  • Append to File: False
  • Continue scripting on Error: False
  • Convert UDDTs to Base Types: False
  • Generate Script for Dependent Objects: False
  • Include Descriptive Headers: True
  • Include If NOT EXISTS: False
  • Include system constraint names: False
  • Schema qualify object names.: True
  • Script Bindings: False
  • Script Collation: True
  • Script Create: True
  • Script Defaults: True
  • Script Drop: False
  • Script Extended Properties: True
  • Script for Server Version: SQL Server 2008
  • Script Logins: False
  • Script Object-Level Permissions: False
  • Script Statistics: Script statistics
  • Script USE DATABASE: True
  • Script Change Tracking: False
  • Script Check Contraints: True
  • Script Data: False
  • Script Data Compression Options: False
  • Script Foreign Keys: True
  • Script Full-Text Indexes: True
  • Script Indexes: True
  • Script Primary Keys: True
  • Script Triggers: True
  • Script Unique Keys: True

enter image description here


Ian Boyd
  • 5,293
  • 14
  • 60
  • 82
  • Does it complete for any other output options? – squillman Feb 11 '13 at 19:18
  • It *does* complete if i use `Single file`. – Ian Boyd Feb 11 '13 at 19:23
  • @sqluillman Interesting, it also completes if i script views, functions, or stored procedures. But as soon as i script a table: it fails to complete. – Ian Boyd Feb 11 '13 at 19:35
  • Can you list the advanced scripting options you have set to true? This comes from the step after you select which objects to script out. – squillman Feb 11 '13 at 20:06
  • Shoot, that might be a 2008 R2 thing. I don't have straight-up 2008 available right now... Do you see something in the wizard that lets you set more options? Things like ansi padding, generate drop and create, include If NOT EXISTS, etc. I can't remember the wizard from 2008 off the top of my head... – squillman Feb 11 '13 at 20:09
  • @squillman Those options are there *"ANSI Padding: True"*, *"Script Create: True"*, *"Include If NOT EXISTS: False"* ... – Ian Boyd Feb 11 '13 at 20:31
  • The same thing happens here. Using SQL 2012 –  Nov 05 '15 at 16:53

0 Answers0