Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. how to desinged tables?

how to desinged tables?

Scheduled Pinned Locked Moved Database
jsontutorialquestion
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    iceman8616
    wrote on last edited by
    #1

    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

    M 1 Reply Last reply
    0
    • I iceman8616

      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

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      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.

      I 1 Reply Last reply
      0
      • M Mycroft Holmes

        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.

        I Offline
        I Offline
        iceman8616
        wrote on last edited by
        #3

        Can you explain in detail, thank you!

        M 1 Reply Last reply
        0
        • I iceman8616

          Can you explain in detail, thank you!

          M Offline
          M Offline
          Mycroft Holmes
          wrote on last edited by
          #4

          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 1 Reply Last reply
          0
          • M Mycroft Holmes

            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 Offline
            I Offline
            iceman8616
            wrote on last edited by
            #5

            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?

            M 1 Reply Last reply
            0
            • I iceman8616

              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?

              M Offline
              M Offline
              Mycroft Holmes
              wrote on last edited by
              #6

              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 and State int or varchar

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups