Skip to content

Instantly share code, notes, and snippets.

Created September 18, 2014 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/946339532950dd08b6a1 to your computer and use it in GitHub Desktop.
Save anonymous/946339532950dd08b6a1 to your computer and use it in GitHub Desktop.
Gratuitous cursor
DECLARE @BeginPostDate NVARCHAR(10)
DECLARE @EndPostDate NVARCHAR(10)
DECLARE @cnt INT
DECLARE XCursor CURSOR LOCAL FORWARD_ONLY
FOR
SELECT
CONVERT(NVARCHAR, ReportFromDate, 101) AS BeginPostDate ,
CONVERT(NVARCHAR, ReportToDate, 101) AS EndPostDate
FROM Dates.ReportingDates
WHERE IsActive = '1';
BEGIN TRANSACTION;
SET @cnt = 0
OPEN XCursor;
FETCH NEXT FROM XCursor INTO @BeginPostDate, @EndPostDate;
WHILE @@FETCH_STATUS = 0
BEGIN
SET @Cnt = @Cnt + 1
FETCH NEXT FROM XCursor INTO @BeginPostDate, @EndPostDate;
END;
CLOSE XCursor;
DEALLOCATE XCursor;
PRINT @BeginPostDate
PRINT @EndPostDate
PRINT @Cnt
EXECUTE Financials.CalculatePremium @BeginPostDate, @EndPostDate, 1300000, 999999999, 'App', 'domain\user'
COMMIT;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment