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

Var in SQL

Status
Not open for further replies.

imox

Programmer
May 13, 2013
37
DE
Hello,

Code:
SELECT * FROM table;
WHERE  table.column [b]=[/b] "value"

how can I set the operator '=' in a variable?
 
You could do macro substitution:
Code:
lcOperator = "=" && or "<" or ">=" etc
SELECT * FROM table WHERE  table.column &lcOperator "value"

Indeed it's not uncommon to put the whole where clause into a string variable lcWhere and then execute
Code:
SELECT * FROM table WHERE &lcWhere

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top