Home All Groups Group Topic Archive Search About

Generate SQL for multiple objects in SQL Server Management Studio

Author
19 May 2006 12:08 PM
UJ
Is there a way to generate SQL for multiple objects through Management
Studio? Also can you generate a drop with a create or a create only?

TIA - Jeff.

Author
20 May 2006 4:24 PM
Erland Sommarskog
UJ (f***@nowhere.com) writes:
> Is there a way to generate SQL for multiple objects through Management
> Studio?

Yes. There are even two. One is to right-click the database, and select
Generate Scripts. This will open a wizard that will permit you to set
some scripting options.

The other is to press F7 to get a summary screen and then navigate to
the group of objects you are interesting in. Here you can make multiple
selections, and then right-click and select Script As. In this case,
you don't have access to any options.

> Also can you generate a drop with a create or a create only?

The scripting wizard gives you two choices: DROP only and CREATE only.
The option DROP + CREATE is missing, and it no appears that no other
feature from SQL 2000 is more missed by the community than this one.


--
Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Author
21 May 2006 1:21 PM
Andrea Montanari
hi Jeff,
UJ wrote:
> Is there a way to generate SQL for multiple objects through Management
> Studio? Also can you generate a drop with a create or a create only?
>
> TIA - Jeff.

in addition to Erland wise advice, you can perhaps have a look at at least 2
other tools..
ScriptIO, available at http://www.sqlteam.com/publish/scriptio/
and my amScript, available at http://www.asql.biz/en/Download2005.aspx
--
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz       http://italy.mvps.org
DbaMgr2k ver 0.19.0 - DbaMgr ver 0.63.0 and further SQL Tools
--------- remove DMO to reply

AddThis Social Bookmark Button