mirror of
https://github.com/Microsoft/sql-server-samples.git
synced 2025-12-08 14:58:54 +00:00
Remove extra spacing
This commit is contained in:
@@ -28,7 +28,7 @@ GO
|
||||
SET IDENTITY_INSERT Product ON
|
||||
GO
|
||||
|
||||
DECLARE @products NVARCHAR(MAX) =
|
||||
DECLARE @products NVARCHAR(MAX) =
|
||||
N'[{"ProductID":15,"Name":"Adjustable Race","Color":"Magenta","Size":"62","Price":100.0000,"Quantity":75,"Data":{"Type":"Part","MadeIn":"China"}},{"ProductID":16,"Name":"Bearing Ball","Color":"Magenta","Size":"62","Price":15.9900,"Quantity":90,"Data":{"ManufacturingCost":11.672700,"Type":"Part","MadeIn":"China"},"Tags":["promo"]},{"ProductID":17,"Name":"BB Ball Bearing","Color":"Magenta","Size":"62","Price":28.9900,"Quantity":80,"Data":{"ManufacturingCost":21.162700,"Type":"Part","MadeIn":"China"}},{"ProductID":18,"Name":"Blade","Color":"Magenta","Size":"62","Price":18.0000,"Quantity":45,"Data":{},"Tags":["new"]},{"ProductID":19,"Name":"Sport-100 Helmet, Red","Color":"Red","Size":"72","Price":41.9900,"Quantity":38,"Data":{"ManufacturingCost":30.652700,"Type":"Еquipment","MadeIn":"China"},"Tags":["promo"]},{"ProductID":20,"Name":"Sport-100 Helmet, Black","Color":"Black","Size":"72","Price":31.4900,"Quantity":60,"Data":{"ManufacturingCost":22.987700,"Type":"Еquipment","MadeIn":"China"},"Tags":["new","promo"]},{"ProductID":21,"Name":"Mountain Bike Socks, M","Color":"White","Size":"M","Price":560.9900,"Quantity":30,"Data":{"Type":"Clothes"},"Tags":["sales","promo"]},{"ProductID":22,"Name":"Mountain Bike Socks, L","Color":"White","Size":"L","Price":120.9900,"Quantity":20,"Data":{"ManufacturingCost":88.322700,"Type":"Clothes"},"Tags":["sales","promo"]},{"ProductID":23,"Name":"Long-Sleeve Logo Jersey, XL","Color":"Multi","Size":"XL","Price":44.9900,"Quantity":60,"Data":{"ManufacturingCost":32.842700,"Type":"Clothes"},"Tags":["sales","promo"]},{"ProductID":24,"Name":"Road-650 Black, 52","Color":"Black","Size":"52","Price":704.6900,"Quantity":70,"Data":{"Type":"Bike","MadeIn":"UK"}},{"ProductID":25,"Name":"Mountain-100 Silver, 38","Color":"Silver","Size":"38","Price":359.9900,"Quantity":45,"Data":{"ManufacturingCost":262.792700,"Type":"Bike","MadeIn":"UK"},"Tags":["promo"]},{"ProductID":26,"Name":"Road-250 Black, 48","Color":"Black","Size":"48","Price":299.0200,"Quantity":25,"Data":{"ManufacturingCost":218.284600,"Type":"Bike","MadeIn":"UK"},"Tags":["new","promo"]},{"ProductID":27,"Name":"ML Bottom Bracket","Price":101.2400,"Quantity":50,"Data":{"Type":"Part","MadeIn":"China"}},{"ProductID":28,"Name":"HL Bottom Bracket","Price":121.4900,"Quantity":65,"Data":{"ManufacturingCost":88.687700,"Type":"Part","MadeIn":"China"}}]'
|
||||
INSERT INTO Product (ProductID, Name, Color, Size, Price, Quantity, Data, Tags)
|
||||
SELECT ProductID, Name, Color, Size, Price, Quantity, Data, Tags
|
||||
@@ -103,7 +103,7 @@ AS BEGIN
|
||||
Data nvarchar(max) AS JSON,
|
||||
Tags nvarchar(max) AS JSON)) as json
|
||||
ON (dbo.Product.ProductID = @ProductID)
|
||||
WHEN MATCHED THEN
|
||||
WHEN MATCHED THEN
|
||||
UPDATE SET
|
||||
Name = json.Name,
|
||||
Color = json.Color,
|
||||
@@ -112,7 +112,7 @@ AS BEGIN
|
||||
Quantity = json.Quantity,
|
||||
Data = json.Data,
|
||||
Tags = json.Tags
|
||||
WHEN NOT MATCHED THEN
|
||||
WHEN NOT MATCHED THEN
|
||||
INSERT (Name,Color,Size,Price,Quantity,Data,Tags)
|
||||
VALUES (json.Name,json.Color,json.Size,json.Price,json.Quantity,json.Data,json.Tags);
|
||||
END
|
||||
|
||||
Reference in New Issue
Block a user