Using Cursors:
DECLARE @date_key INT
DECLARE date_cursor CURSOR FOR
SELECT date_key FROM dim_date WHERE [year] = 2013 ORDER BY date_key
OPEN date_cursor
FETCH NEXT FROM date_cursor INTO @date_key
WHILE @@FETCH_STATUS = 0
BEGIN
SELECT @date_key
--Insert code by @date_key here
FETCH NEXT FROM date_cursor INTO @date_key
END
CLOSE date_cursor
DEALLOCATE date_cursor
No comments:
Post a Comment