You must Sign In to post a response.
  • Category: SQL Server

    How to check updated column name in SQL

    Hi all

    I have 2 SQL table with same structure as below

    Table 1

    ENo Ename Gender

    1 ABC M

    Table 2

    ENO Ename Gender

    1 XYZ M

    in the above table how can i find out different value column .this case Ename column having different value. so result must be Ename.

    let me know the sql query to implement this logic


  • #762148
    Hello Sarvana Perumal,

    You can use Triggers. Refer about the same on MSDN Code Library on below mentioned link :

    Hope this will help you.

    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"

  • #762149

    You can try this Query

    Select Ename from Table1 where Ename<>
    (Select Ename from Table1)

    Name : Dotnet Developer-2015
    Email Id

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #762173

    You can use update trigger to find the modified columns in your table.

    Refer below links where you can find solution for your query.


    Sridhar Thota.

    Sridhar Thota.
    Editor: DNS Forum.

  • #762196

    Thanks for your reply.. Got Code for this.. here by I post

    declare @action_field varchar(max)

    SELECT @action_field = Isnull(@action_field + ', ', '') + name
    FROM syscolumns
    WHERE id = (select object_id from sys.tables where name = 'tablename)
    AND CONVERT(VARBINARY, Reverse(Columns_updated())) & Power(CONVERT(BIGINT, 2), colorder - 1) > 0

    The above code capture the updated column value with comma separated value.

    Thanks & Regards
    Saravana Perumal.N

Sign In to post your comments