Row-Column Comparision

  • how can we compare the Row values into column.

    E.g.

    Create table ABC( A INT, B INT, C INT )

    Create table Schema( ID INT, Colname CHAR(1) )

    ID Colname

    1 A

    2 B

    3 C

    I want to check the record in below manner....

    When Schema.Colname = ABC.Colname THEN ID ELSE 0 END

    Abhijit - http://abhijitmore.wordpress.com

  • Please, explain your actual business requirements in more detail. At least show us the expected result.

    ML

    ---
    Matija Lah, SQL Server MVP
    http://milambda.blogspot.com

  • use the DMV to to at the actual column schema info.

    such as:

    select * from sys.columns where [object_id] = object_id('mytablename')

    that will give you access to the column name for your table. you can then use it in your comparison

    The more you are prepared, the less you need it.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply