I have some .sql-files with creates tables (MS SQL Database):
table_1.sql:
IF OBJECT_ID (N'my_schema.table1', N'U') IS NOT NULL
DROP TABLE my_schema.table1;
CREATE TABLE my_schema.table1(
id int IDENTITY PRIMARY KEY,
nameTable1 varchar(255) NOT NULL UNIQUE
);
and table_2.sql:
IF OBJECT_ID (N'my_schema.table2', N'U') IS NOT NULL
DROP TABLE my_schema.table2;
CREATE TABLE my_schema.table2(
id int IDENTITY PRIMARY KEY,
nameTable2 varchar(255) NOT NULL UNIQUE
);
so, and I want run these two .sql-files in third file: run_all_tables.sql, How can to run table_1.sql and table_2.sql via run_all_tables.sql, I think it should be similar:
run_all_tables.sql:
BEGIN;
\i table_1.sql
\i table_2.sql
COMMIT;
What must be in run_all_tables.sql for to run table_1.sql and table_2.sql? If you have MS SQL Database (Microsoft SQL Server)