1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| USE mydatabase
DECLARE @RC int
DECLARE @rsc_id varchar(10)
DECLARE @rsc_name varchar(50)
DECLARE @schdp_startDateString varchar(10)
DECLARE @schdp_endDateString varchar(10)
set @schdp_startDateString = CONVERT(VARCHAR(10), DATEADD(day,+3,GETDATE()), 105)
set @schdp_endDateString = CONVERT(VARCHAR(10), DATEADD(day,+3,GETDATE()), 105)
DECLARE resource_cursor CURSOR FOR
SELECT RSC_ID, RSC_NAME FROM RESOURCE
ORDER BY RSC_ID
OPEN resource_cursor
-- Perform the first fetch and store the values in variables.
-- Note: The variables are in the same order as the columns
-- in the SELECT statement.
FETCH NEXT FROM resource_cursor
INTO @rsc_id, @rsc_name
-- Check @@FETCH_STATUS to see if there are any more rows to fetch.
WHILE @@FETCH_STATUS = 0
BEGIN
-- Concatenate and display the current values in the variables.
PRINT 'Resource: ' + @rsc_id + ' ' + @rsc_name + ' ' + CONVERT(VARCHAR(10), DATEADD(day,1,GETDATE()), 105)
EXECUTE @RC = [mydatabase].[dbo].[cr_getSchedule_10]
@rsc_id
,@schdp_startDateString
,@schdp_endDateString
-- This is executed as long as the previous fetch succeeds.
FETCH NEXT FROM resource_cursor
INTO @rsc_id, @rsc_name
END
CLOSE resource_cursor
DEALLOCATE resource_cursor |
Partager