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.
Author |
Topic |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-08-01 : 08:22:26
|
Sam writes "Folks,This seems to be an easy question but I can not find a sampleto do this.I am writing a query and I need the user to be able tointeractively type in the parameter value before runningthe query. How do I prompt the user for input using Query Analyzer and Tsql ?The non-interactove way is to use something like this :DECLARE @pname varchar (50);SET @pname = 'myproject' ;SELECT project_name, date, location FROM projectsWHERE project_name = @pname " |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-08-01 : 08:24:23
|
If they're using Query Analyzer the only "interactive" way to change a parameter is to do what you're doing now. You can simplify it somewhat by making it a stored procedure, but that's it. QA is not a user interface really, you'd have to design one using ASP/VB/C/C# or maybe MS Access. |
|
|
jasper_smith
SQL Server MVP & SQLTeam MVY
846 Posts |
Posted - 2002-08-01 : 08:32:44
|
That's not what QA is for.You shouldn't give QA to users.You could use just about any client tool you wanted.However in SQL2000 QA you can create templates using the .tql extension and then open them in QA and press Ctrl+Shift+M - this brings up a dialog box to allow you to specify parameter replacementsThese are specified using the following syntaxuse Northwindgoselect * from Customers where CustomerID = '<CustomerID,char(5),ALFKI>' i.e. parameters are delimited by < > and are in the format<parameter name,datatype,default value>Again I'll say though - QA is not a tool for normal users. Its a development/DBA tool.HTHJasper Smith |
|
|
|
|
|