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
CREATE PROCEDURE [Orders].[SumAllOrdersPerCustomer] @CustomerId INT = 0 | |
AS | |
SELECT SUM(OrderSum) | |
FROM [Orders].[Orders] | |
WHERE CustomerId = @CustomerId |
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
CREATE TABLE [dbo].[Namen] ( | |
[Id] INT NOT NULL PRIMARY KEY | |
, [Namen] NVARCHAR(50) | |
) |
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
CREATE SCHEMA [Orders] AUTHORIZATION [dbo] |
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
terraform { | |
required_providers { | |
docker = { | |
source = "kreuzwerker/docker" | |
} | |
} | |
} | |
provider "docker" {} |
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
docker run - name mySqlServer -e ACCEPT_EULA=Y -e SA_PASSWORD=MyStrongPA55word! -p 1433:1433 -d mcr.microsoft.com/mssql/server:2019-latest |
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
CREATE Type JobDef AS TABLE( | |
[JobName] SYSNAME PRIMARY KEY | |
, [JobId] UNIQUEIDENTIFIER | |
, [Description] NVARCHAR(512) NULL | |
) | |
CREATE TYPE JobStepDef AS TABLE( | |
[Id] INT NOT NULL IDENTITY(1,1) PRIMARY KEY | |
, [job_name] SYSNAME NOT NULL | |
, [job_id] UNIQUEIDENTIFIER NULL |
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
/** | |
Basic version of creating job and jobsteps on an sql server. | |
**/ | |
-- create a agent job | |
EXEC msdb.dbo.sp_add_job | |
@job_name = 'The daily test job'; | |
-- add a jobstep to the job | |
EXEC msdb.dbo.sp_add_jobstep | |
@job_name = 'The daily test job', |
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
/** | |
A bit tricky since it would normally run on msdb, but use statements are not allowed here | |
**/ | |
-- add the job if it does not exist | |
DECLARE @ref_name SYSNAME | |
SELECT @ref_name = [name] | |
FROM msdb.dbo.sysjobs | |
WHERE [name] = 'The daily test job' |
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
CREATE LOGIN owi WITH PASSWORD = 'Bazinga1!' MUST_CHANGE, CHECK_EXPIRATION=ON, DEFAULT_DATABASE = DataStore ; | |
GO | |
CREATE USER owi FOR LOGIN owi | |
GO | |
ALTER ROLE db_owner ADD MEMBER owi | |
GO | |
-- Add some permissions the the schema for the newly created user |
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
-- Create the Schema, owned by dbo. | |
CREATE SCHEMA [tables] AUTHORIZATION dbo; | |
GO | |
CREATE SCHEMA Consumer AUTHORIZATION dbo; | |
GO |
NewerOlder