• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

SQL Update identifier

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    SQL Update identifier

    I need to include a record version number in an SQL server express (2008) database. Currently this is done manually, but it seems I ought to be able to do something like this automatically. All it is is a field that should change whenever an update is done.

    Have tried a variety of searches to no great avail, any suggestions ?

    Cheers.

    #2
    Try using trigger on update: http://msdn.microsoft.com/en-us/libr...4(SQL.80).aspx

    This can be performance bottleneck if you update a lot.

    Comment


      #3
      Originally posted by AtW View Post
      Try using trigger on update: http://msdn.microsoft.com/en-us/libr...4(SQL.80).aspx

      This can be performance bottleneck if you update a lot.
      AtW,

      That is in fact what I am doing, but it just "feels" as though there ought to be a more automatic way. ISTR this was possible with oracle.

      Comment


        #4
        You just create a column of type rowversion

        http://msdn.microsoft.com/en-us/library/ms182776.aspx

        Its value changes everytime the row is updated.

        Comment


          #5
          Originally posted by DimPrawn View Post
          You just create a column of type rowversion

          http://msdn.microsoft.com/en-us/library/ms182776.aspx

          Its value changes everytime the row is updated.
          Great, thanks !!

          Comment


            #6
            Originally posted by DimPrawn View Post
            You just create a column of type rowversion

            http://msdn.microsoft.com/en-us/library/ms182776.aspx

            Its value changes everytime the row is updated.
            That's a better technical advice than mine Dimmy... the first one I heard from you!

            P.S. In my defence I felt really to suggest using Trigger in database...

            Comment

            Working...
            X