Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Run Multiple Scripts
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
01394631
Message ID:
01394636
Vues:
46
>>>How do I run multiple table generation scripts all together as one?
>>
>>Just put everything in one long script and have GO between some statements and run from SSMS.
>
>I have table generation scripts in separate files, such as:
>
>
>EXEC sp_DropTable 'bm_Addresses'
>
>SET ANSI_NULLS ON
>GO
>SET QUOTED_IDENTIFIER ON
>GO
>
>CREATE TABLE bm_Addresses
>	(AddressKey	int	IDENTITY	NOT NULL,
>	 AddressTypeKey      int		NOT NULL,
>	 Street1		varchar(40)		NOT NULL,
>	 Street2		varchar(40),			
>	 City		varchar(40)		NOT NULL,
>	 State		char(2)		NOT NULL,
>	 PostalCode	char(10)		NOT NULL)
>
>-- Add the Primary Key
>ALTER TABLE bm_Addresses WITH NOCHECK 
>	ADD CONSTRAINT [PK_bm_Addresses] 
>	PRIMARY KEY NONCLUSTERED (AddressKey)
>
>
>
>I have 30 or so scripts, and I want to run them all at once


Where?
In SSMS? If so the Naomi's suggestion should work. Just open them in one Query window and put GO between them.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform