Flag in SQL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Limno
    New Member
    • Apr 2008
    • 92

    Flag in SQL

    Hi,

    Is there any Flag function in SQL Server. I want to set Flag=1 at 1st time entry. if i change that value or edit its value same record values, it's value should become 2.
    I dont Know whether itz front end work or SQL holds any Flag function. So, can any one suggest me.

    Thanks in Advance.
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    You need to add an additional field to database and keep that updating as per your requirment.

    Comment

    • Limno
      New Member
      • Apr 2008
      • 92

      #3
      Originally posted by debasisdas
      You need to add an additional field to database and keep that updating as per your requirment.

      Thanks for replying me,

      Can u give me more explanation to this. yes i m hving one field has Flag. But i dont know hw to do this.

      Can u explain me with Query Example. Please.

      Limno

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        You need to write a trigger for the purpose.

        Comment

        • ck9663
          Recognized Expert Specialist
          • Jun 2007
          • 2878

          #5
          1. Create a field on your table for this flag.

          2. Set the default value of this field to 1.

          3. Create a trigger that will handle the replace of the value for this field for every update or delete.

          -- CK

          Comment

          Working...