Posted on: 7/16/2014 2:29:24 PM | Views : 487

I have 2 tables: Departments and Employees.  I need the CREATE TABLE and the INSERT INTO to work together with a GO statement or something?  I have tried the GO in about every place but can not get it to work.


CREATE TABLE [dbo].[Departments] ( [Id] INT identity(1,1) NOT NULL PRIMARY KEY, [Name] varchar(50) NULL, [Location] varchar(50) NULL ) INSERT INTO [Departments] VALUES (1,"IT","New York") INSERT INTO [Departments] VALUES (2,"HR","London") INSERT INTO [Departments] VALUES (3,"Payroll","Sydney")

CREATE TABLE [dbo].[Employees] ( [Id] INT identity(1,1) NOT NULL PRIMARY KEY, [FirstName] varchar(50) NULL, [LastName] varchar(50) NULL, [Gender] varchar(50) NULL, [Salary] money NULL, [DepartmentID] int foreign key references Departments(Id)
) INSERT INTO [Employees] VALU ...

Go to the complete details ...