DECLARE VARIABLES INSIDE VIEW?

  • Hi,

    Can I declare variables inside a view? I want to set the subquery result to a variable and use that variable in the query. How can I do that? Please let me know.

    Thanks,

    Sridhar!!

  • You just can't... you must use the subquery as the variable.

    If you need to use that variable more than once, may I suggest you create a derived table and join to that table? That way you could use the variable as often as you need without re-requering it.

  • O.K. Thanks

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

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