how to desinged tables?
-
hi everybody! I am working for a project named "Video Monitor". It required "record video by plan". My logic designed as follow: 1.date type data. ------------------------ date date type --------- ------------ monday working day . . . . . . friday working day saturday rest day sunday rest day 1.1 New Year's Day 2009.10.30 special day 1 2010.2.3 special day 2 . . . . . . -------------------------- 2.day record plan ------------------------------------------------------------------- day time action cameraNum ---- ------- --------- ------------ working day 06.00 begin record by timed 1,2 working day 18.00 end record by timed 1,2 rest day 06.00 begin record by move detect
-
hi everybody! I am working for a project named "Video Monitor". It required "record video by plan". My logic designed as follow: 1.date type data. ------------------------ date date type --------- ------------ monday working day . . . . . . friday working day saturday rest day sunday rest day 1.1 New Year's Day 2009.10.30 special day 1 2010.2.3 special day 2 . . . . . . -------------------------- 2.day record plan ------------------------------------------------------------------- day time action cameraNum ---- ------- --------- ------------ working day 06.00 begin record by timed 1,2 working day 18.00 end record by timed 1,2 rest day 06.00 begin record by move detect
We use a combination of a user defined function UDF and a table called holidays, this allows us to generate a record set of #n dates and if the date is in the holiday table it is flagged. We use a combination of dayinweek and the holiday table to define processing dates. I am stuck with a Chinese New Year that does not have a fixed date.
-
We use a combination of a user defined function UDF and a table called holidays, this allows us to generate a record set of #n dates and if the date is in the holiday table it is flagged. We use a combination of dayinweek and the holiday table to define processing dates. I am stuck with a Chinese New Year that does not have a fixed date.
Can you explain in detail, thank you!
-
Can you explain in detail, thank you!
Do you know what a UDF is and how they function? Create a UDF that returns a rowset with dates and their state for defined period eg 200 days from 1/10/2009 In the UDF you create a table variable that you populate using the DataAdd function in a while loop You then update the state based of DayOfWeek function You then do a join to the holiday table to update the state based on dates entered by the user into the holiday table (All of the above can be achieved in 1 step but try it in 3 steps to get a feel for the processes) Return the rowset to the stored proc that called it where it can be used in a join or select statement.
-
Do you know what a UDF is and how they function? Create a UDF that returns a rowset with dates and their state for defined period eg 200 days from 1/10/2009 In the UDF you create a table variable that you populate using the DataAdd function in a while loop You then update the state based of DayOfWeek function You then do a join to the holiday table to update the state based on dates entered by the user into the holiday table (All of the above can be achieved in 1 step but try it in 3 steps to get a feel for the processes) Return the rowset to the stored proc that called it where it can be used in a join or select statement.
i know UDF is user defined function. but i want to know is the column's type, for example, monday and 2010.1.0 column's data type,is date? or enum? or others?
-
i know UDF is user defined function. but i want to know is the column's type, for example, monday and 2010.1.0 column's data type,is date? or enum? or others?
iceman8616 wrote:
2010.1.0 column's data type
This is not a date!
iceman8616 wrote:
or enum
I do not know of an enum column data type in SQL Server I would have a 2 column table
Date datetime
andState int or varchar