Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 SQL Query to invoke Input Box

Author  Topic 

pazo
Starting Member

4 Posts

Posted - 2008-01-24 : 19:05:24
Hi All, I am new to this forum, but hope you guys can help. I am writing a rather simple query, but need the query to ask for user input. For example:

Select * From Table
Where column = [Input Box]

I know this works for a fact in Microsoft Query, but does not work in Query Analyzer. What syntax would work in Query Analyzer that would make the Input Box pop up to ask for user input?

Thanks in advance.

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-01-24 : 23:14:31
No, can't do that with t-sql.
Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2008-01-25 : 07:35:13
any user interaction should be done in a (more) proper user-front end...vb, c, c++, c#, asp.net, etc....

QA is best described as technical tool/aid....and not for interacting direct with users.
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2008-01-25 : 08:30:03
I totally aggree with AndrewMurphy - however, I think in sql2000 QueryAnalyzer, if you navigate to a stored procedure in the object explorer and "right-click | open" an SP a little dialog box will open allowing the user to add parameter values and then exec the SP.

Be One with the Optimizer
TG
Go to Top of Page

pazo
Starting Member

4 Posts

Posted - 2008-01-25 : 11:14:29
The query really only asks for a date, and to build a front end app seems inpractical. In reality, it is a batch file:

bcp "Select * From Table where date = ?" queryout C:\Date.xml -S servername.domain.local -T -c -t ~

I know when I was taking my SQL class the professor showed us how to make an input box ask a basic question, but that was in Query Analyzer. I do not know if the same would work in Command Prompt.

Thanks guys for trying, and thanks for the fast responses.
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-01-26 : 00:59:51
You can put bcp command in batch file and pass parameter to batch file in dos.
Go to Top of Page

pazo
Starting Member

4 Posts

Posted - 2008-01-28 : 11:14:33
Excuse me for my lack of knowledge, but how can I pass a parameter to the batch file. My ultimate goal is for the user to double click on the batch file. It would ask him for the record ID, and then I would have an XML file sitting, waiting in the root folder. If you can provide any resource, or explain further on how to pass a parameter to a batch file, that would be great.

Thank you.
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-01-28 : 21:21:15
Ask your windows admin for help on batch file issue.
Go to Top of Page
   

- Advertisement -