From 4edcd6ad4efaab2b020b90dbd8ce61d6ae148fec Mon Sep 17 00:00:00 2001 From: Lorcan Neary Date: Tue, 8 Feb 2022 22:17:46 +0000 Subject: [PATCH] sql dir added --- sql/sp_Insert_User.sql | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 sql/sp_Insert_User.sql diff --git a/sql/sp_Insert_User.sql b/sql/sp_Insert_User.sql new file mode 100644 index 000000000000..0d9b8626dcf9 --- /dev/null +++ b/sql/sp_Insert_User.sql @@ -0,0 +1,19 @@ +create or alter procedure sp_Insert_User +( + --user attributes +@full_name varchar(100), +@email varchar(200), +@oid varchar(100) +) +WITH EXECUTE AS 'dbo' +AS +BEGIN + declare @dummy_company_id int; + + --selects the id of the company record associated with 'initial_import_company' + set @dummy_company_id = (select id from [dbo].[company] c where c.name like 'initial_import_company') + + --Creates new company record + INSERT INTO [dbo].[user]([company_id],[oid],[email],[full_name],[is_active],[is_superuser]) + VALUES (@dummy_company_id, @oid, @email, @full_name,1,0); + END