mirror of
https://github.com/Mastermindzh/dotfiles.git
synced 2025-07-30 14:13:47 +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
|
Reference in New Issue
Block a user