-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding column constraint references test
Signed-off-by: Emanuel Calvo <emanuel@ongres.com>
- Loading branch information
Showing
2 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
USE master; | ||
GO | ||
|
||
CREATE SCHEMA [Babelfish_COLCONST]; | ||
GO | ||
|
||
create table [Babelfish_COLCONST].[a] ( | ||
id int identity primary key, | ||
texto varchar(50) NOT NULL | ||
); | ||
GO | ||
|
||
create table [Babelfish_COLCONST].[b] ( | ||
id int identity primary key, | ||
foreign_id int not null references [Babelfish_COLCONST].[a], | ||
texto varchar(50) NOT NULL | ||
); | ||
GO | ||
|
||
create table [Babelfish_COLCONST].[c] ( | ||
id int identity primary key, | ||
foreign_id int not null, | ||
foreign key(foreign_id) references [Babelfish_COLCONST].[a](id), | ||
texto varchar(50) NOT NULL | ||
); | ||
GO | ||
|
||
SET IDENTITY_INSERT [Babelfish_COLCONST].[a] ON; | ||
insert into [Babelfish_COLCONST].[a](id,texto) values(1, 'some text'); | ||
SET IDENTITY_INSERT [Babelfish_COLCONST].[a] OFF; | ||
GO | ||
~~ROW COUNT: 1~~ | ||
|
||
|
||
insert into [Babelfish_COLCONST].[b](foreign_id, texto) values(1,'insert text'); | ||
GO | ||
~~ROW COUNT: 1~~ | ||
|
||
|
||
insert into [Babelfish_COLCONST].[c](foreign_id, texto) values(1,'insert text'); | ||
GO | ||
~~ROW COUNT: 1~~ | ||
|
||
|
||
DROP TABLE [Babelfish_COLCONST].[c]; | ||
DROP TABLE [Babelfish_COLCONST].[b]; | ||
DROP TABLE [Babelfish_COLCONST].[a]; | ||
DROP SCHEMA [Babelfish_COLCONST]; | ||
GO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
USE master; | ||
GO | ||
|
||
CREATE SCHEMA [Babelfish_COLCONST]; | ||
GO | ||
|
||
create table [Babelfish_COLCONST].[a] ( | ||
id int identity primary key, | ||
texto varchar(50) NOT NULL | ||
); | ||
GO | ||
|
||
create table [Babelfish_COLCONST].[b] ( | ||
id int identity primary key, | ||
foreign_id int not null references [Babelfish_COLCONST].[a], | ||
texto varchar(50) NOT NULL | ||
); | ||
GO | ||
|
||
create table [Babelfish_COLCONST].[c] ( | ||
id int identity primary key, | ||
foreign_id int not null, | ||
foreign key(foreign_id) references [Babelfish_COLCONST].[a](id), | ||
texto varchar(50) NOT NULL | ||
); | ||
GO | ||
|
||
SET IDENTITY_INSERT [Babelfish_COLCONST].[a] ON; | ||
insert into [Babelfish_COLCONST].[a](id,texto) values(1, 'some text'); | ||
SET IDENTITY_INSERT [Babelfish_COLCONST].[a] OFF; | ||
GO | ||
|
||
insert into [Babelfish_COLCONST].[b](foreign_id, texto) values(1,'insert text'); | ||
GO | ||
|
||
insert into [Babelfish_COLCONST].[c](foreign_id, texto) values(1,'insert text'); | ||
GO | ||
|
||
DROP TABLE [Babelfish_COLCONST].[c]; | ||
DROP TABLE [Babelfish_COLCONST].[b]; | ||
DROP TABLE [Babelfish_COLCONST].[a]; | ||
DROP SCHEMA [Babelfish_COLCONST]; | ||
GO |