13 | | {{{ |
14 | | #!sql |
15 | | CREATE DATABASE [ProjectName]_MetaData |
16 | | GO |
17 | | CREATE DATABASE [ProjectName]_Data |
18 | | GO |
19 | | CREATE DATABASE [ProjectName]_WorkData |
20 | | GO |
21 | | |
22 | | CREATE LOGIN [ProjectName]_MetaData WITH PASSWORD = '[ProjectName]_MetaData'; |
23 | | GO |
24 | | CREATE LOGIN [ProjectName]_Data WITH PASSWORD = '[ProjectName]_Data'; |
25 | | GO |
26 | | CREATE LOGIN [ProjectName]_WorkData WITH PASSWORD = '[ProjectName]_WorkData'; |
27 | | GO |
28 | | |
29 | | USE [ProjectName]_MetaData |
30 | | CREATE USER [ProjectName]_MetaData FOR LOGIN [ProjectName]_MetaData |
31 | | GO |
32 | | EXEC sp_addrolemember N'db_owner', N'[ProjectName]_MetaData' |
33 | | GO |
34 | | |
35 | | USE [ProjectName]_Data |
36 | | CREATE USER [ProjectName]_Data FOR LOGIN [ProjectName]_Data |
37 | | GO |
38 | | EXEC sp_addrolemember N'db_owner', N'[ProjectName]_Data' |
39 | | GO |
40 | | |
41 | | USE [ProjectName]_WorkData |
42 | | CREATE USER [ProjectName]_WorkData FOR LOGIN [ProjectName]_WorkData |
43 | | GO |
44 | | EXEC sp_addrolemember N'db_owner', N'[ProjectName]_WorkData' |
45 | | GO |
46 | | |
47 | | }}} |
48 | | |
49 | | |
50 | | === 1a. Create Bespoke Data Import Stored Procedures |
51 | | |
52 | | Create the bespoke data import stored procedures by copying them from another project: |
53 | | |
54 | | * INSERT_EID_MAP_FROMTEMP_RB |
55 | | * INSERT_PATIENT_FROMTEMP_RB |
56 | | * INSERT_PID_MAP_FROMTEMP_RB |
57 | | * CREATE_TEMP_TABLE |
58 | | |
| 13 | Before running you will need to use Find and Replace to replace the string `{Study Name}` with the name of the study. |