SQL Server Management Studio not scripting all objects

Posted by Ian Boyd on Server Fault See other posts from Server Fault or by Ian Boyd
Published on 2009-09-18T22:40:46Z Indexed on 2011/11/15 1:56 UTC
Read the original article Hit count: 606

i've been attempting to script a database using SQL Server 2005 Management Studio. i cannot get it to script some objects. It scripts others, but skips some.

i can provide detailed screen shots

  • the options being selected
  • including all tables
  • the folder where the script files will go
  • the folder being empty before scripting
  • the scripting process saying Sucess when scripting a table
  • the destination folder no longer empty, with a hundred or so script files
  • the script of some tables not being in the folder.

And earlier SSMS would not script some views.

Is this a known thing that the the Generate Scripts task does not generate scripts?


Update

Known issue on Microsoft Connect, but Microsoft couldn't repro the steps, so they closed closed the ticket.

Fails on SQL Server 2005, also fails on SQL Server 2008.


Update Two

Some basic questions:

1.What version of SQL Server?

 Microsoft SQL Server 2000 - 8.00.194 (Intel X86)
 Microsoft SQL Server 2005 - 9.00.3042.00 (Intel X86)
 Microsoft SQL Server 2008 - 10.0.2531.0 (Intel X86)
 Microsoft SQL Server 2005 Management Studio: 9.00.4035.00
 Microsoft SQL Server 2008 Management Studio: 10.0.1600.22

2.What O/S are you running on?

 Windows Server 2000
 Windows Server 2003
 Windows Server 2008

3.How are you logging in to SQL server?

 sa/password
 Trusted authentication

4.Have you verified your account has full access to all objects?

 Yes, i have access to all objects.

5.Can you use the objects that fail to script? (eg: select top(10) * from nonScriptingTable)

 Yes, all objects work fine.
 SQL Server Enterprise Manager can script the objects fine.


Update Three

They fail no matter what version of SQL Server you script against. It wasn't a problem in Enterprise Manager:

Client Tools  SQL Server 2000  SQL Server 2005  SQL Server 2008
============  ===============  ===============  ===============
2000          Yes              n/a              n/a
2005          No               No               No
2008          No               No               No

Update Four

No errors found in the database using:

DBCC CHECKDB
go
DBCC CHECKCONSTRAINTS
go
DBCC CHECKFILEGROUP
go
DBCC CHECKIDENT
go
DBCC CHECKCATALOG
go
EXECUTE sp_msforeachtable 'DBCC CHECKTABLE (''?'')'

Honk if you hate SSMS.

© Server Fault or respective owner

Related posts about sql-server-2005

Related posts about scripting