-
Notifications
You must be signed in to change notification settings - Fork 1
/
AddToCart.sql
40 lines (34 loc) · 1.01 KB
/
AddToCart.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
USE [PartsWeb]
GO
/****** Object: StoredProcedure [dbo].[AddToCart] Script Date: 07/25/2021 09:55:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[AddToCart](
@pcschema CHAR(10),
@Username CHAR(10),
@Part VARCHAR (10),
@InqPart VARCHAR (10),
@Rate NUMERIC(10,3),
@Brand VARCHAR(10),
@ConfQty INT,
@Remarks VARCHAR(100),
@CreatedDate DateTime,
@CreatedTime DateTime
)
AS
BEGIN
SET NOCOUNT OFF
IF EXISTS (SELECT *FROM PATCART WHERE PCPART = @Part AND PCBRAND = @Brand AND PCUSER = @Username)
BEGIN
UPDATE PATCART SET PCCONFQTY = @ConfQty, PCREMARKS = @Remarks, PCCREATEDDATE = @CreatedDate, PCCREATEDTIME = @CreatedTime
WHERE PCPART = @Part AND PCBRAND = @Brand AND PCUSER = @Username
END
ELSE
BEGIN
INSERT INTO PATCART(PCAPPL, PCUSER, PCPART, PCINQPART, PCRATE, PCBRAND, PCCONFQTY, PCREMARKS, PCCREATEDDATE, PCCREATEDTIME) VALUES(
@pcschema, @Username, @Part, @InqPart, @Rate, @Brand, @ConfQty, @Remarks, @CreatedDate, @CreatedTime)
END
END
GO