May 11, 2010 at 12:04 am
DECLARE @vFrDate INT,@vToDate INT
DECLARE @DQDates INT
DECLARE @Selection BIT,@Selection1 BIT,@Selection2 FLOAT
SET @DQDates=(SELECT DATEDIFF(day, '2004-10-14', '2010-03-26'))
DECLARE @TEMPCOMMISION TABLE
(
Id INT IDENTITY(1,1) NOT NULL,
Client NVARCHAR (100),
FromDate INT,
ToDate INT,
Commision FLOAT,
ColCommision FLOAT
)
INSERT INTO @TEMPCOMMISION(Client ,FromDate,ToDate ,Commision,ColCommision )SELECT clientName, fromDate, toDate, commissionRate,0
FROM commissionMaster
DECLARE @FromDate INT
DECLARE cDates CURSOR FOR SELECT fromDate FROM @TEMPCOMMISION
OPEN cDates
FETCH NEXT FROM cDates INTO @FromDate
WHILE @@FETCH_STATUS = 0
BEGIN
SET @vFrDate=0
SET @vToDate=110
IF(@DQDates >= @vFrDate)
BEGIN
SET @Selection=1
END
IF(@DQDates <= @vToDate)
BEGIN
SET @Selection2=1
END
IF(@Selection = @Selection1)
BEGIN
SET @Selection2=(SELECT Commision FROM @TEMPCOMMISION)
END
FETCH NEXT FROM cDates INTO @FromDate
END
CLOSE cDates
DEALLOCATE cDates
May 11, 2010 at 12:49 am
What did you try to say?
I don't see any point in this script and SELECT statement does not have any criteria and @FromDate populated by cursor is not used anywhere.
_____________
Code for TallyGenerator
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply