Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2003
    Posts
    6

    Question Unanswered: ORDERING by a paramater sent to a sp

    I might just be really tired but I can't seem to figure out if this is possible or not. What I'm trying to do is send a paramater that represents a clumn name to sort on into a stored proc and it's not working.. just wondering if anyone had any ideas..


    Thanks!!!

  2. #2
    Join Date
    Jan 2003
    Location
    London, England
    Posts
    106
    I just tried it out and I couldn't get it to work either...I really don't have any good ideas on how to solve this. At least not now, my brain is fried and I'm going home.
    Frettmaestro
    "Real programmers don't document, if it was hard to write it should be hard to understand!"

  3. #3
    Join Date
    Jan 2003
    Posts
    6
    well... I drank some caffeine and did some searching and there is one solution that works and it can be found here


    http://www.sqlteam.com/item.asp?ItemID=2209


    make sure you also read the comments since for some odd reason in the case statement you can't have columns of different data types...



    John

  4. #4
    Join Date
    Jan 2003
    Posts
    12

    Re: ORDERING by a paramater sent to a sp

    Originally posted by Octavian
    I might just be really tired but I can't seem to figure out if this is possible or not. What I'm trying to do is send a paramater that represents a clumn name to sort on into a stored proc and it's not working.. just wondering if anyone had any ideas..


    Thanks!!!
    try this
    select @my_var = sql_statement_with_where_clause
    exec (@my_var)

    exec is a function which will resolve variables before executing.

    Racheal

Posting Permissions

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