Avatar of eeyo

asked on 

SQL Server SQL Query Excluding Specific Field Values (Efficienct Code)

Using  VB.NET Winforms application:  Essentially, I would like to generate a list of GUIDS to exclude from a query (anywhere from about 10 to 1000 GUIDS).  I am looking to determine which of these is most efficient.  Assuming that I have read-only access, can run SQL query code (but not create stored procedures).  

1)  Dynamically create a SQL WHERE clause to exclude the GUIDS (e.g. "WHERE field1 is NOT IN ('GUID1', 'GUID2", etc...)"
2) Create temporary table in SQL, load the excluded GUIDS, then run the final query against standard tables JOINed with this temporary table
3) Other?
Microsoft SQL ServerVisual Basic.NETSQL

Avatar of undefined
Last Comment

8/22/2022 - Mon