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

How to use a Function in SQL

Status
Not open for further replies.

nat1967

Technical User
Feb 13, 2001
287
US
Hi everyone,

Is it possible to use a function in a SQL query?

Here is the SQL:

WHERE USER = "nharrison"

What I would like to do is call a Function called Husers. This function
builds a list of all the current users that I need to query on. Currently,
I have each one listed in the SQL statement. However, that gets to be a
nightmare if users are added or removed.

The function works and brings back this:

'nharrison', Or 'tomcat', Or 'ddog'

I just dont know how to have the Where statement call this function.

any thoughts?


Have A Great Day!!!, [bigglasses]

Nathan
Senior Test Lead
 
Hi Nathan!

I am not sure if you can do that in the criteria or not. Is it possible to get all the names you need using a query? If so then you can use a subquery like this:

Where User IN ("Select Name From YourTable Where YourCriteria")

hth


Jeff Bridgham
bridgham@purdue.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top