Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameter Query

Status
Not open for further replies.

mikej336

MIS
Feb 10, 2005
164
US
Is it possible to do a parameter query in SQL Server like you can in Access, where a box will popup and prompt you for information to complete the query.

And can I store that parameter to variable so I can use it in subsequent quaries.

Thanks

Uncle Mike
 
yeah, this can be done. however you will have to add one extra step, ie declaring the variables themselves.

e.g.:

Declare @var int
set @var=1
select * from Table where Col=@var


Known is handfull, Unknown is worldfull
 
Any ideas about the popup box that prompts for the date?

Thanks again

Uncle Mike
 
You would have to create the popup box in client side code and pass it to SQL.

Hope this helps,

Alex

[small]----signature below----[/small]
I don't do any programming whatsoever

Ignorance of certain subjects is a great part of wisdom
 
mikej336

There is a fundamental difference between SQL Server and Access (as it pertains to your question).

Access is 2 applications in 1. With Access, there is a database engine. You submit queries, it responds with data. In addition to the database engine, there is the front end aspect. With the front end, you can create windows, forms, reports, etc...

With SQL Server, you have a database engine. This engine is far superior to the database engine that is available with Access (if you configure and tune it properly). SQL Server does ship with some 'client tools'. The most popular are (in no particular order) Enterprise Manager (EM), Query Analyzer (QA), and SQL Server Management Studio (SSMS). EM & QA are distributed with SQL 2000. SSMS is distributed with SQL 2005.

The client tools distributed with SQL Server should never be used by end users. Only developers should have access to these tools. It's too easy to completely destroy your database. For example... click on a table to highlight it, then press the delete button on your keyboard. Whoosh... there goes your table. The same thing applies to views, procedures, functions, etc... It's just too dangerous to allow end users access to these tools.

In light of the previous paragraph, having a popup window to prompt for a parameter is a bit meaningless. Since these tools are developed for developers, it's unnecessary.

If you insist, there is a way to accomplish this.

In these tools, when you right click on a stored procedure, then click OPEN, you will be presented with a dialog box prompting you for the value(s) of the parameter(s).

-George

"the screen with the little boxes in the window." - Moron
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top