Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2003
    Location
    OH
    Posts
    10

    Unanswered: Selecting a Column Dynamically

    Hi all,
    I would like to view values of a particular column from a table and it can be any column depending on some situations. To be precise my query would look like:

    ----------------------

    SELECT 'DAY_' + '1' from SCHEDULING

    ----------------------

    But it would give simply 'DAY_1' as the result, instead it should give the values of the Column 'DAY_1' from the SCHEDULING table. Is there any way to convert an nvarchar to a table's column type.

    Any input is highly appreciated,
    Thanks,
    darbhas.

  2. #2
    Join Date
    Sep 2003
    Posts
    522
    smells like dynamic sql, unless you're willing to enumerate all your columns in a big IF or CASE statement.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •