Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Run Multiple Scripts
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01394631
Message ID:
01394636
Views:
45
>>>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform