Pointers in SQL Server

  • Hi,

    I've got an interesting problem and I'm hoping that someone will be able to point me in the right direction. Here it is

     

    Declare @a varchar(10)

    Declare @b-2 varchar(10)

    Set @a = 'any value'

    Set @b-2 = '@a'

     

    Now as you can see that variable b holds the name of variable a. I'm trying to find a way to access variable b in such a manner that it returns the value of variable a. Basically, if I say

    Select @b-2

    It should return 'a value' not '@a'.

     

    Regards,

    Raza

  • I'm pretty sure that this is not what you mean but...

    Declare @a varchar(10)

    Declare @b-2 varchar(10)

    Set @a = 'any value'

    Set @b-2 = @a

    Select @a, @b-2

    any valueany value

  • I wish it was that simple. I need something like an eval() function available in few languages.

  • What problem are you trying to solve?

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

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