• SQLTestUser (6/17/2013)


    the logic is to trace where the user is in the application at a certain period, and display the information on the application accordingly. So i added a column and i am trying to figure out the data from different table and update the related column accordingly.

    an update would do that for existing records but for new records i need the column to update each time the records change in different table. i hope that made mo sense than my original post

    It seems like you are making this more then you need to? One way to solve this so you can track what screen or whatever a user is to could create a simple table.

    create table UserLocation

    (

    UserID int,

    UserLocation varchar(50)

    )

    Now when there is a row for the current user you just update this one row. If it doesn't exist, you create it. Make that a stored proc that receives those two parameters and this becomes a lot simpler than trying to jump through all these hoops.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/