Forum Discussion
Shift rota added to SQL script
It would help if you could include code and what you expect to see. You can do a sequence to cycle:
DROP SEQUENCE IF EXISTS dbo.fred;
CREATE SEQUENCE dbo.fred
AS TINYINT
START WITH 1
INCREMENT BY 1
MINVALUE 1
MAXVALUE 14
CYCLE
NO CACHE;
DECLARE @i INT = 0
WHILE @i < 100
BEGIN
SELECT NEXT VALUE FOR dbo.fred;
SET @i = @i + 1;
END;
If "date calendar " is a table with dates, just update that table with the shifts you want it to have (that will also give you the ability to override values later too.
If I am off base, provide some data structures and what the output should be and someone might be able to help
Louis Davidson the table is in the data base which is used across the network not specific for our area so the query is very easy
The tables been created so finance can report using the financial years , financial weeks etc
so the query is as simple as a select * from perfecttable
the only thing I require is to add a shift pattern