1
Answer

sql

Navaz

Navaz

10y
1.1k
1

USE [dbs_Maxsell_Version2]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER Procedure [dbo].[sp_Stock_Master_Insert '15','15','11','AAAA']
@Vehicle_No varchar(100),
@LR_No varchar(100),
@No_Of_Bundles varchar(50),
@Remarks varchar(Max)

As
declare @stock_transfer_id int
set @stock_transfer_id =(select Stock_Transfer_Id from Stock_Transfer_Master)
declare @Stock_Transfer_Date datetime
declare @Counter_Name varchar(50)
declare @Purchase_Master_Id int
declare @Delivery_Note_No int
declare @Counter_Name_From varchar(50)

Set @Stock_Transfer_Date =(select Stock_Transfer_Date from Stock_Transfer_Master where Stock_Transfer_Id =@stock_transfer_id)
set @Counter_Name =(select Counter_Name from Stock_Transfer_Master)
Set @Purchase_Master_Id =(select @Purchase_Master_Id from Stock_Transfer_Master where Stock_Transfer_Id =@stock_transfer_id)
set @Delivery_Note_No =(select Delivery_Note_No from Stock_Transfer_Master where Stock_Transfer_Id =@stock_transfer_id)
Set @Counter_Name_From=(select Counter_Name_From from Stock_Transfer_Master where Stock_Transfer_Id =@stock_transfer_id)

INSERT INTO Stock_Transfer_Master
(Stock_Transfer_Date,
Counter_Name,
Purchase_Master_Id,
Delivery_Note_No,
Counter_Name_From,
Vehicle_No,
LR_No,
No_Of_Bundles,
Remarks)
VALUES (@Stock_Transfer_Date,
@Counter_Name,
@Purchase_Master_Id,
@Delivery_Note_No,
@Counter_Name_From,
@Vehicle_No,
@LR_No,
@No_Of_Bundles,
@Remarks)


--Begin


-- Declare @ReferenceID int
-- Select @ReferenceID = @@IDENTITY
-- Return @ReferenceID

--End

 
 
 
error like 
Msg 512, Level 16, State 1, Procedure sp_Stock_Master_Insert, Line 10
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
Msg 512, Level 16, State 1, Procedure sp_Stock_Master_Insert, Line 18
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
Msg 515, Level 16, State 2, Procedure sp_Stock_Master_Insert, Line 23
Cannot insert the value NULL into column 'Stock_Transfer_Date', table 'dbs_Maxsell_Version2.dbo.Stock_Transfer_Master'; column does not allow nulls. INSERT fails.
The statement has been terminated. 
 
 

Answers (1)