Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Join Date
    Jun 2004
    Location
    Far away from heaven
    Posts
    194

    Unanswered: User Input in Query Analyzer

    Hi folks, i am lookin for an option in the QA to take user input while executing a query. just like we do in SQLPLUS:
    SELECT * FROM dept WHERE deptno=$abc
    here it would ask me for the deptno. I guess it's a very handy feature and we could test our variables and calculations withing the procedures etc.

    Is there a way, or any substitute?


    Howdy!

  2. #2
    Join Date
    Jan 2004
    Location
    Shanghai,China
    Posts
    76
    It's the oracle features,not supported in SQL server's query analyzer

  3. #3
    Join Date
    Jun 2004
    Location
    Far away from heaven
    Posts
    194
    ??????????????????

  4. #4
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    User prompts are not supported through SQL, and Query Analyzer is strictly an SQL editor and executor.

    Despite that, Query Analyzer is worlds better than Oracle's SQL Plus Worksheet. But the bottom line is that NEITHER should be considered a user application interface.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  5. #5
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    WHY?

    And here you go....

    The prompt has to go somewhere.....
    Code:
    USE Northwind
    GO
    
    DECLARE @x int
    SELECT @x = 10248
    
    SELECT * FROM orders WHERE OrderID = @x
    And you can do that with PL/SQL? Never did that...

    Now DB2 QMF...that's another story.....

    But they are ALL best left out of the hands of the user....
    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.

  6. #6
    Join Date
    Jun 2004
    Location
    Far away from heaven
    Posts
    194
    Query Analyzer is worlds better than Oracle's SQL Plus Worksheet
    Surely, no doubt about it.

    Hi brett, the way u've described is not rather handy. Sorry!


    I wish if this feature were in Yukon.

  7. #7
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    I Wish Not!
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  8. #8
    Join Date
    Jun 2004
    Location
    Far away from heaven
    Posts
    194
    Guru, i just asked for this feature because sometime it helps in changing the variable values in queries in spite of changing values manually. Testing etc.
    What's the reason for denial?

  9. #9
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Ok...so link Access to your db, create a query in the QBE Grud and put a predicate in like

    [What value do you want]
    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.

  10. #10
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    Quote Originally Posted by thebeginner
    Guru, i just asked for this feature because sometime it helps in changing the variable values in queries in spite of changing values manually. Testing etc.
    What's the reason for denial?
    Hey, don't need to be so caustic, I just think that every tool serves a specific purpose, and QA is not the right one for what you want to accomplish, OK?
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  11. #11
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Quote Originally Posted by rdjabarov
    Hey, don't need to be so caustic, I just think that every tool serves a specific purpose, and QA is not the right one for what you want to accomplish, OK?

    'bout fell of my barstool...um office chair......

    look who's talking....

    But it just happens I agree....

    Can you tell us what you're trying to do?
    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.

  12. #12
    Join Date
    Jun 2004
    Location
    Far away from heaven
    Posts
    194
    I just wanted that i not re-enter the values of variables by searching them in my code while testing. Instead the values shall be asked.
    Leave it, i can't fight u.

  13. #13
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Declare and set your test variables at the top of your procedure, and when you realize that to try a variation on your code you just need to change one variable rather than type them all into prompts EVERY TIME YOU EXECUTE you may realize that this is a good way to test things. Plus, you know right away if odd results were due to typos.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  14. #14
    Join Date
    Dec 2002
    Posts
    1,245
    Actually, there is a way to do this (kind of). Open up one of the templates that come with SQL QA (File | New, pick a template).

    Once in the template, hit CTRL + SHIFT + M.

    A dialog box will (should) open prompting you with the variables that you can edit. It will then do a find and replace on those variables and substitute the values you typed in.

    For example; open the one for Add SQL Server login. Hit CTRL + SHIFT + M. Voila.

    The tricky part is that you would have to replicate the syntax, which I think is:
    '<variable_name, datatype, default value>'

    Regards,

    hmscott

    PS: And no, I am not encouring the use of QA as a user tool. I think the question is legitimate, I just hope this helps.
    Have you hugged your backup today?

  15. #15
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    BUT OF COURSE...

    Damn hangover....

    http://weblogs.sqlteam.com/brettk/ar...5/25/1378.aspx

    Is it 5:00 yet?
    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
  •