John writes "Hi all, This probably isn't challenging but for a beginer like me its hitting me pretty hard. I am creating a .NET class that recieves 3 items: the users IP address, usersDNS and the users User_agent. I would like to perform certian functions based on what i find when i compare this information to the database.In my database i have 3 tables: BadIPs, GoodUA, GOODIPsIn the BadIPs table I have these fields : ID int, IP nvarchar(15), DNS nvarchar(255), UsrAgnt nvarchar(255), name nvarchar(50)
In the GoodIPs table I have these Fields: ID int, IP nvarchar(15), DNS nvarchar(255)
And Finally i have in the GoodUA table these fields: ID int, UA nvarchar(255)
Basicly i need to create a stored proc that1. checks the goodtables for matching fields, then if returns a match,returns a value for "good" and then skips the next step.2. if no match is made in step 1 then is searches the Bad table for matches in ip,dns,and usragnt field. If match is made it returns a value for "bad" with also the 'Name"value found. 3. if no match is found in step 2 then it returns a value for "good" and closes.Personaly Im stuck. I can see a couple of ways to go about this but i have no clue on how to do this in the fastest method! I am using SQL Server 7 with the most uptodate service pack on a win2k service pack 2 machine. Im not even sure if i made up the tables the most effeciant way either. Any help would be appreciated. the Bad list is about 8000 rows large and the good tables only about 300 rows each.John Hamman"