Can I use T-SQL to get user input as parameter ?

  • Hello:

       I am a new user of SQL server 2000, and I want to write a simple T-SQL to get user input as query parameters just alike:

      declare @input int

      set @input=inputbox(...)   <---   the function to get user keyin data

      .. sql command use @input ....

       I have search for a whole afternoon but couldn't find any suggestion to achieve my goal.

       Can I do this purpose without other programing language cowork?

       Any suggestion would be appreciated.

    Carl

  • No, it won't work this way. Stored Procedures can accept parameters, of course, but not with such a direct user interaction like a Inputbox. You might want to read the Onlinehelp on how to accomplish this.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • I agree, transact sql isn't meant to be used this way.  What are you using as a user front-end for the database?  Microsoft Access?  Whatever you're using as the interface to sql server should be popping up the inputbox, and passing that to the stored procedure.

    There is a way to accomplish it, but it involves creating a dts package with an activex control that'll prompt the user for a parameter.  But, I believe this creates some nasty locking problems while the user input is being waited for...

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

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