I am using SQL Server 2014 in which i had designed the database to work on the General store management.
I have to input the item along with its Supplier name its stock and Name of item. I have to execute three statements for this purpose, that is why I am using the transaction option as I need to roll back again if there is any type of problem during the implementation. Here is the SQL which I have been facing many issues with.
Here is the SQL code that I am trying to run:
BEGIN TRANSACTION AddItem
INSERT INTO Product(Name, Stock, Type_Id, Pur_Price, Sale_Price)
VALUES ('Lemon', 20, 2, 129, 325);
INSERT INTO Supplier(Name, Contact_No)
VALUES ('Kamran', '034637827');
INSERT INTO Purchase(Product_id, Supplier_Id, Quantity)
VALUES(EXEC spGetProductId @Name= 'Lemon', EXEC spGetSupplierId @Name='Kamran', 20);
COMMIT AddItem
ROLLBACK