hi Experts,
The user wants to manually input the business contract No. up to 50 in table A. Table B will be called based on how many business contract no. was input in table A. For example, If the user input 5 business contract no. in table A, then the table B will show the related data for those 5 business contract no.
We do not want to do it by parameter, since 50 is too much.
Thank you,
I have encounter the issues. The stored procedure only returned the top 4 rows of data. If I input 5 contract strings or 50 contract strings, it only returned top 4 contract string data. Do you have any suggestions? Thank you.
The data type of contract strings is varchar. They are displayed as
Contract String
193-859655
193-859616
193-859331
193-859187
Those are my code below
Open in new window
create procedure [dbo].[sp_rept_TitleLoan_A
@Contract varchar(50)
/*************************
Created by: Joy Tan
Created on: 7/20/2016
Description: For the report Auction Sales Summary By Contract
**************************
As
Begin
--Set DATEFIRST 2
--declare @ReportDate datetime
--Set @ReportDate=DateAdd(d,-1,C
SELECT StoreName,VendorName, LoanStoreID,ContractString
ISNULL(AutomobileBlackBook
AuctionCheckAmount,(Auctio
FROM (
SELECT StoreName, LoanStoreID,ContractString
,case when VendorName is null then 'Not Entered' else vendorname end as VendorName,
(SELECT SUM(TransactionPrincPaid) FROM tblReportingTransactions WHERE tblLoans.LoanID=tblReporti
AutomobileBlackBookValue,A
tblVP.UserFirstName+' '+tblVP.UserLastName AS VPName,tblAM.UserFirstName
FROM tblvendors tblvendors right join
tblLoans tblloans on tblvendors. vendorid= tblloans.auctionvendorid INNER JOIN
tblCustomers ON tblLoans.CustomerID=tblCus
tblAutomobiles ON tblLoans.AssetID=tblAutomo
tblStores ON tblLoans.LoanStoreID=tblSt
tblUsers tblVP ON tblStores.vpID=tblVP.UserI
tblUsers tblAM ON tblStores.amID=tblAM.UserI
WHERE
AssetTypeID=1
AND LoanStatusID=2
AND CONTRACTSTRING IN (select value from [dbo].[Split] (@Contract, ','))
)tblDisposal
ORDER BY VPName,AMName, LoanStoreID
End
GO
Open in new window