mirror of
https://github.com/Mastermindzh/dotfiles.git
synced 2025-08-02 15:45:20 +02:00
uploading template files
This commit is contained in:
32
templates/SQL/MsSQL/CREATE SCRIPT.sql
Normal file
32
templates/SQL/MsSQL/CREATE SCRIPT.sql
Normal file
@@ -0,0 +1,32 @@
|
||||
/* Replace XDATABASE with the DB name */
|
||||
USE MASTER
|
||||
GO
|
||||
|
||||
-- Function will delete a database even when in use.
|
||||
BEGIN TRY
|
||||
ALTER DATABASE XDATABASE SET SINGLE_USER WITH ROLLBACK IMMEDIATE
|
||||
DROP DATABASE XDATABASE
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
raiserror('XDATABASE doesn''t exist. Continuing....', 10, 1)
|
||||
END CATCH;
|
||||
GO
|
||||
|
||||
CREATE DATABASE XDATABASE
|
||||
GO
|
||||
|
||||
USE XDATABASE
|
||||
GO
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `Template`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE [Template] (
|
||||
[Column1] INT NOT NULL,
|
||||
[Column2] VARCHAR(30) NOT NULL,
|
||||
[Column3] VARCHAR(30) NOT NULL,
|
||||
CONSTRAINT pk_column1 PRIMARY KEY ([Column1]),
|
||||
CONSTRAINT ck_column2 CHECK ([Column2] in ('M','V')),
|
||||
CONSTRAINT fk_column3 FOREIGN KEY ([Column3]) REFERENCES Patient([Patientnr])
|
||||
)
|
||||
GO
|
15
templates/SQL/MsSQL/INSERT SCRIPT.sql
Normal file
15
templates/SQL/MsSQL/INSERT SCRIPT.sql
Normal file
@@ -0,0 +1,15 @@
|
||||
/* Replace XDATABASE with the DB name */
|
||||
USE XDATABASE
|
||||
GO
|
||||
-- SET LANGUAGE DUTCH /* ONLY USE WHEN WORKING WITH DUTCH DATES*/
|
||||
GO
|
||||
-- -----------------------------------------------------
|
||||
-- Table `Template`
|
||||
-- -----------------------------------------------------
|
||||
INSERT INTO [Template]
|
||||
([Column1] , [Column2] ,[Column3] ,[Geboortedatum]) VALUES
|
||||
('1' , 'A' , 'a' , '03-02-1957'),
|
||||
('2' , 'B' , 'a' , '22-08-1957')
|
||||
GO
|
||||
|
||||
-- SET LANGUAGE ENGLISH
|
23
templates/SQL/MySQL/CREATE SCRIPT.sql
Normal file
23
templates/SQL/MySQL/CREATE SCRIPT.sql
Normal file
@@ -0,0 +1,23 @@
|
||||
-- -----------------------------------------------------
|
||||
-- Table `Template`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `Template` (
|
||||
`id` INT NOT NULL AUTO_INCREMENT ,
|
||||
`Title` VARCHAR(30) NOT NULL ,
|
||||
PRIMARY KEY (`id`) )
|
||||
ENGINE = InnoDB;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `References`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `References` (
|
||||
`url` VARCHAR(400) NOT NULL ,
|
||||
`Templates_id` INT NOT NULL ,
|
||||
PRIMARY KEY (`url`, `Templates_id`) ,
|
||||
INDEX `fk_References_Template_idx` (`Templates_id` ASC) ,
|
||||
CONSTRAINT `fk_References_Template`
|
||||
FOREIGN KEY (`Template_id`)
|
||||
REFERENCES `Template` (`id`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
ENGINE = InnoDB;
|
4
templates/SQL/MySQL/INSERT SCRIPT.sql
Normal file
4
templates/SQL/MySQL/INSERT SCRIPT.sql
Normal file
@@ -0,0 +1,4 @@
|
||||
-- -----------------------------------------------------
|
||||
-- Table `Template`
|
||||
-- -----------------------------------------------------
|
||||
INSERT INTO `Template` (`id`) VALUES ('1');
|
Reference in New Issue
Block a user