Files
2026-07-12 13:56:05 +04:00

65 lines
2.1 KiB
Transact-SQL

USE [Database]
DECLARE
@article_number_attribute_id AS INT,
@barcode_attribute_id AS INT,
@date_of_manufacture_attribute_id AS INT,
@expiration_date_attribute_id AS INT;
SET @article_number_attribute_id =
(SELECT [id]
FROM [Tables].[attributes]
WHERE [name] = N'Article number');
SET @barcode_attribute_id =
(SELECT [id]
FROM [Tables].[attributes]
WHERE [name] = N'Barcode');
SET @date_of_manufacture_attribute_id =
(SELECT [id]
FROM [Tables].[attributes]
WHERE [name] = N'Date of manufacture');
SET @expiration_date_attribute_id =
(SELECT [id]
FROM [Tables].[attributes]
WHERE [name] = N'Expiration date');
DECLARE
@product_id_1 AS INT,
@product_id_2 AS INT,
@product_id_3 AS INT,
@product_id_4 AS INT;
EXECUTE [Procedures].[insert_product]
@name = N'Hobby World Êàðòî÷íàÿ èãðà Óæàñ Àðêõýìà',
@product_type_id = 9, -- Íàñòîëüíûå èãðû
@barcode_attribute_id = @barcode_attribute_id,
@inserted_product_id = @product_id_1 OUTPUT;
EXECUTE [Procedures].[insert_product]
@name = N'Æåâàòåëüíàÿ ðåçèíêà Orbit Mega Êëóáíèêà, áåç ñàõàðà, 16,4 ã',
@product_type_id = 23, -- Æåâàòåëüíàÿ ðåçèíêà
@barcode_attribute_id = @barcode_attribute_id,
@inserted_product_id = @product_id_2 OUTPUT;
EXECUTE [Procedures].[insert_product]
@name = N'Æåâàòåëüíàÿ ðåçèíêà Mentos Pure White âêóñ Êëóáíèêà, 15,5 ã',
@product_type_id = 23, -- Æåâàòåëüíàÿ ðåçèíêà
@barcode_attribute_id = @barcode_attribute_id,
@inserted_product_id = @product_id_3 OUTPUT;
EXECUTE [Procedures].[insert_product]
@name = N'Ïå÷åíüå Oreo, ñ êàêàî è íà÷èíêîé ñî âêóñîì êëóáíèêè, 228 ã',
@product_type_id = 22, -- Ïå÷åíüå
@barcode_attribute_id = @barcode_attribute_id,
@inserted_product_id = @product_id_4 OUTPUT;
INSERT INTO [Tables].[product_attributes]([product_id], [attribute_id])
VALUES
(@product_id_2, 3),
(@product_id_2, 4),
(@product_id_3, 3),
(@product_id_3, 4);
INSERT INTO [Tables].[product_values]([product_id], [attribute_id], [value])
VALUES
(2, 3, N'1900-01-01'), -- Äàòà èçãîòîâëåíèÿ
(2, 4, N'3650'), -- Ñðîê ãîäíîñòè
(3, 3, N'1900-01-01'),
(3, 4, N'30');