Click here to Skip to main content
15,887,485 members
Home / Discussions / Database
   

Database

 
GeneralRe: Executing querys in distributed server Pin
Vipin.d22-Oct-07 22:32
Vipin.d22-Oct-07 22:32 
Questionin sql server 2005 i need to send e mails periodically. Pin
prasadbuddhika22-Oct-07 19:51
prasadbuddhika22-Oct-07 19:51 
AnswerRe: in sql server 2005 i need to send e mails periodically. Pin
neeraj_indianic22-Oct-07 20:18
neeraj_indianic22-Oct-07 20:18 
AnswerRe: in sql server 2005 i need to send e mails periodically. Pin
Marek Grzenkowicz22-Oct-07 23:51
Marek Grzenkowicz22-Oct-07 23:51 
Question[SOLVED] Create a database in Microsoft SQL Server 2005 Pin
CodingLover22-Oct-07 18:57
CodingLover22-Oct-07 18:57 
AnswerRe: Create a database in Microsoft SQL Server 2005 Pin
CodingLover22-Oct-07 20:04
CodingLover22-Oct-07 20:04 
QuestionData driven schedule with Reporting Services Pin
deemikey22-Oct-07 14:10
deemikey22-Oct-07 14:10 
QuestionSQL Query Pin
Giri K22-Oct-07 13:07
Giri K22-Oct-07 13:07 
Anyone pls help me!! i am newbie. i got query below, i want the result as NF 20000.00 if it is refinanceAmount. i know below is not a proper query

IF L.LoanID EXISTS IN (SELECT LoanID, RefinanceAmount FROM FastLoan_Applications.dbo.tblLoanPurpose)
SET @LoanAmount = 'N.F.'@RefinanceAmount

Here is the Main SP

set ANSI_NULLS OFF
set QUOTED_IDENTIFIER OFF
GO


ALTER PROC [dbo].[upUpfront_GetPending]
@UserID varchar(10)
AS
BEGIN

--ASSERTION: If a weekly and a monthly upfront run is in pending simultaneously, this SP will only return the weekly upfront.
--To get monthly upfront, weekly must be processed first.

--GET CURRENT UPFRONT COMMISSION RUN (WEEKLY OR MONTHLY, BUT ONLY ONE)
DECLARE @CommissionRunID int
SELECT @CommissionRunID = CommissionRunID
FROM tblCommissionRun
WHERE CommissionRunTypeID IN (1,2)
AND Pending = 1

--UPFRONT LOANS
SELECT U.UpfrontID,
AG.IntroducerID [AggregatorID],
AG.TradingName [Aggregator],
I.IntroducerID,
I.TradingName,
U.LoanID,
'' [LoanIncrease], --tooltip
A.ShortName,
LS12.StageDate [SettlementDate],
L.LoanAmount [Amount],
U.UpfrontRate,
U.UpfrontAmount,
U.ApplicationFee,
U.UpfrontGST,
U.UpfrontTotal
FROM tblUpfront U
INNER JOIN FastLoan_Applications.dbo.vwIntroducer I ON I.IntroducerID = U.IntroducerID
INNER JOIN FastLoan_Applications.dbo.tblLoan L ON L.LoanID = U.LoanID
INNER JOIN FastLoan_Applications.dbo.tblApplication A ON A.ApplicationID = L.ApplicationID
LEFT JOIN FastLoan_Applications.dbo.tblLoanStage LS12 ON LS12.LoanID = L.LoanID
LEFT JOIN FastLoan_Applications.dbo.vwIntroducer AG ON AG.IntroducerID = I.Aggregator
IF L.LoanID EXISTS IN (SELECT LoanID, RefinanceAmount FROM FastLoan_Applications.dbo.tblLoanPurpose)
SET @LoanAmount = 'N.F.'@RefinanceAmount
WHERE U.CommissionRunID = @CommissionRunID
AND LS12.LoanStageTypeID = 6
AND U.LoanIncreaseID IS NULL

UNION ALL

--UPFRONT LOAN INCREASES
SELECT U.UpfrontID,
AG.IntroducerID [AggregatorID],
AG.TradingName [Aggregator],
I.IntroducerID,
I.TradingName,
U.LoanID,
'Loan Increase' [LoanIncrease], --tooltip
A.ShortName,
LIS12.StageDate [SettlementDate],
LI.IncreaseAmount [Amount],
U.UpfrontRate,
U.UpfrontAmount,
U.ApplicationFee,
U.UpfrontGST,
U.UpfrontTotal
FROM tblUpfront U
INNER JOIN FastLoan_Applications.dbo.vwIntroducer I ON I.IntroducerID = U.IntroducerID
INNER JOIN FastLoan_Applications.dbo.tblLoanIncrease LI ON LI.LoanIncreaseID = U.LoanIncreaseID
INNER JOIN FastLoan_Applications.dbo.tblLoan L ON L.LoanID = LI.LoanID
INNER JOIN FastLoan_Applications.dbo.tblLoanPurpose LP ON LP.LoanID = L.LoanID
INNER JOIN FastLoan_Applications.dbo.tblApplication A ON A.ApplicationID = L.ApplicationID
LEFT JOIN FastLoan_Applications.dbo.tblLoanIncreaseStage LIS12 ON LIS12.LoanIncreaseID = LI.LoanIncreaseID
LEFT JOIN FastLoan_Applications.dbo.vwIntroducer AG ON AG.IntroducerID = I.Aggregator
WHERE U.CommissionRunID = @CommissionRunID
AND LIS12.LoanStageTypeID = 6
AND U.LoanIncreaseID IS NOT NULL
ORDER BY I.TradingName

END


Thanks in Advance.
AnswerRe: SQL Query Pin
Marek Grzenkowicz23-Oct-07 0:00
Marek Grzenkowicz23-Oct-07 0:00 
AnswerRe: SQL Query Pin
Giri K23-Oct-07 14:31
Giri K23-Oct-07 14:31 
Questionselect query doubt Pin
Vipin.d22-Oct-07 3:51
Vipin.d22-Oct-07 3:51 
AnswerRe: select query doubt Pin
Vipin.d22-Oct-07 3:58
Vipin.d22-Oct-07 3:58 
AnswerRe: select query doubt [modified] Pin
GuyThiebaut22-Oct-07 4:44
professionalGuyThiebaut22-Oct-07 4:44 
QuestionHelp in designing search query Pin
NetBot22-Oct-07 3:03
NetBot22-Oct-07 3:03 
AnswerRe: Help in designing search query Pin
Michael Potter22-Oct-07 5:05
Michael Potter22-Oct-07 5:05 
QuestionDisplay SQL query results in Windows Form Pin
hobbsieoz22-Oct-07 2:36
hobbsieoz22-Oct-07 2:36 
AnswerRe: Display SQL query results in Windows Form Pin
Paddy Boyd22-Oct-07 5:01
Paddy Boyd22-Oct-07 5:01 
QuestionConvert comma separated text file (.csv) file into access .mdb file Pin
shyamts22-Oct-07 1:41
shyamts22-Oct-07 1:41 
AnswerRe: Convert comma separated text file (.csv) file into access .mdb file Pin
_Damian S_22-Oct-07 17:21
professional_Damian S_22-Oct-07 17:21 
Question[Solved]Insert statement against a FoxPro database isn't commited using ODBCConnection in C# Pin
Larantz21-Oct-07 22:49
Larantz21-Oct-07 22:49 
QuestionRead binary data from SQL Server Pin
Eusebiu Marcu21-Oct-07 22:11
Eusebiu Marcu21-Oct-07 22:11 
AnswerRe: Read binary data from SQL Server Pin
Eusebiu Marcu21-Oct-07 23:44
Eusebiu Marcu21-Oct-07 23:44 
QuestionSqlQueries Pin
SreejithAchutan21-Oct-07 22:06
SreejithAchutan21-Oct-07 22:06 
AnswerRe: SqlQueries Pin
Colin Angus Mackay21-Oct-07 23:04
Colin Angus Mackay21-Oct-07 23:04 
AnswerRe: SqlQueries Pin
John-ph22-Oct-07 0:48
John-ph22-Oct-07 0:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.