Created
November 27, 2015 06:51
-
-
Save zv0r/1477bbb0cb3ebd8ce4ff to your computer and use it in GitHub Desktop.
AISCreateKlerDB
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
-- ID архива, в котором создается тематическая БД | |
DECLARE @archID INT | |
SET @archID = 2 | |
-- Имя тематической базы анных | |
DECLARE @dbName NVARCHAR(2000) | |
SET @dbName = 'Клировые ведомости' | |
DECLARE @dbID TABLE(Id INT) | |
-- Создание тематической базы данных (ТБД). | |
-- Также записать ID созданной ТБД | |
INSERT INTO [AISArchive].[dbo].[tblThemeCatalog] ( | |
ParentId | |
,Name | |
,CreationTime | |
,DeletionTime | |
,Deleted | |
,ArchiveId | |
) | |
OUTPUT Inserted.Id INTO @dbID | |
SELECT 0 ,@dbName ,CURRENT_TIMESTAMP ,NULL ,0 ,@archID | |
-- Вставка полей БД | |
INSERT INTO [AISArchive].[dbo].[tblItemsAdditionalFields] ( | |
ItemType | |
,ParentItemId | |
,FieldType | |
,ColumnName | |
,ShownName | |
,OrderNumber | |
,ItemType2 | |
) | |
VALUES | |
(9, (SELECT Id FROM @dbID), 1, 'nvarchar9', 'Листы', 1, NULL) | |
,(9, (SELECT Id FROM @dbID), 1, 'nvarchar1', 'Тип населённого пункта', 2, NULL) | |
,(9, (SELECT Id FROM @dbID), 1, 'nvarchar2', 'Населённый пункт', 3, NULL) | |
,(9, (SELECT Id FROM @dbID), 1, 'nvarchar3', 'Уезд', 4, NULL) | |
,(9, (SELECT Id FROM @dbID), 1, 'nvarchar7', 'Церковь', 5, NULL) | |
,(9, (SELECT Id FROM @dbID), 1, 'nvarchar8', 'Год', 6, NULL) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment