Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2007
    Posts
    6

    Question Unanswered: How to compare dynamic variable in proc

    I have a table with 52 columns named 'Week1', 'Week2' etc. with values 1, 0 etc. I want to check values in each column. I have following lines in my procedure.

    Declare @l_str varchar(50),
    @l_count int

    Select @l_count = 1
    Select @l_str = 'Week' + Convert(varchar, @l_count)
    Now how do I compare the value stored in the @l_str which should be wither 0 or 1 and not 'Week1'?

    Is there any better method to compare read these 52 table variables?

    Thanks in advance

  2. #2
    Join Date
    Jul 2005
    Location
    New Zealand
    Posts
    61
    Compare with what?

  3. #3
    Join Date
    Sep 2007
    Posts
    6
    Compare to check what does Week1 holds 1 or 0?

  4. #4
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Quote Originally Posted by Ash20
    I have a table with 52 columns named 'Week1', 'Week2' etc. with values 1, 0 etc.
    It may be the liquid lunch, but


    BBBBBBBBBWWWWWWWWWWWWWWWWWAAAAAAAAAAAAHHHAAHAHAHA
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

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