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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do i use the WHERE clause with parameters

Status
Not open for further replies.

philmorris1000

Technical User
Aug 9, 2000
1
GB
Is it possible to be able to pass a variable to the WHERE clause when trying to select data. <br>Foe example i am using Delphi to search a database and i wish to be able to write an sql statement something like this<br><br>SELECT * from customers WHERE state = statevariable<br><br>statevariable is set at run time by delphi <br><br>i can't seem to be able to make this work<br><br>PLEASE HELP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thanks Phil Morris
 
um, for one that command is a string, so you kind of append the variable to the end of the string. <p>Karl<br><a href=mailto:kb244@kb244.com>kb244@kb244.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
 
Can you pass it thru a stored procedure?&nbsp;&nbsp;I don't know delphi, but if you can make a call like this:<br><br>exec sp_CustByState @State<br><br>You can create a stored procedure like this:<br><br>Create Procedure sp_CustByStat<br><br>@State varchar(2)<br><br>AS<br><br>Select *<br>From Customer<br>Where State = @State<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top