Click here to Skip to main content
15,920,956 members
Home / Discussions / Database
   

Database

 
GeneralUsing MDB database with OLEDB/ATL/MFC (from SQL Server) Pin
Gian26-Jul-04 2:15
Gian26-Jul-04 2:15 
GeneralWindows-only authentication not working Pin
sid98dha26-Jul-04 0:40
susssid98dha26-Jul-04 0:40 
GeneralRe: Windows-only authentication not working Pin
Mike Dimmick26-Jul-04 5:29
Mike Dimmick26-Jul-04 5:29 
GeneralCurious about a query Pin
brdavid25-Jul-04 15:12
brdavid25-Jul-04 15:12 
GeneralRe: Curious about a query Pin
Grimolfr26-Jul-04 4:26
Grimolfr26-Jul-04 4:26 
GeneralRe: Curious about a query Pin
brdavid26-Jul-04 6:04
brdavid26-Jul-04 6:04 
GeneralRe: Curious about a query Pin
Michael Potter26-Jul-04 10:36
Michael Potter26-Jul-04 10:36 
GeneralRe: Curious about a query Pin
Grimolfr26-Jul-04 11:28
Grimolfr26-Jul-04 11:28 
Like Michael said. The LIKE keyword is specifically used for pattern matching, and even if you don't use a pattern, the query builder will still probably build the query using the pattern matching algorithm, which is always going to be less efficient than a simple equality algorithm. Depending on the data you're matching, the difference could be inconsequential, or it could be dramatic.

Plus, if you have the field indexed, the equality comparison (or >, <, >=, <=, etc) will use the index much more efficiently. The LIKE operator will do a full index scan, to look for all fields that might match the pattern. The equality operator can use the index as it's intended, by starting with only the rows where that field begins with 'S'. Some database engines may automatically do this with LIKE statements that don't begin with a wildcard. Others may not.

AND, the real reason I brought it up. The IN keyword replaces multiple equality checks. I.e. field IN ('Val1', 'Val2') is translated by the query builder into (field = 'Val1' OR field = 'Val2'). Note that the only difference in this and your original query is the parentheses, which can make all the difference in the world if used properly (or not, as the case may be.)


Grim
(aka Toby)
MCDBA, MCSD, MCP+SB


SELECT * FROM user WHERE clue IS NOT NULL
GO
(0 row(s) affected)

GeneralHOW: format date field in sql Pin
JabraJabra25-Jul-04 13:16
JabraJabra25-Jul-04 13:16 
GeneralRe: HOW: format date field in sql Pin
darkbyte29-Jul-04 1:37
darkbyte29-Jul-04 1:37 
GeneralData type Pin
Peter Mayhew25-Jul-04 4:42
Peter Mayhew25-Jul-04 4:42 
GeneralRe: Data type Pin
Peter Mayhew27-Jul-04 9:24
Peter Mayhew27-Jul-04 9:24 
GeneralDEADLOCK PROBLEMc (ASAP) Pin
Anonymous24-Jul-04 23:26
Anonymous24-Jul-04 23:26 
GeneralRe: DEADLOCK PROBLEMc (ASAP) Pin
Michael Potter26-Jul-04 11:17
Michael Potter26-Jul-04 11:17 
General@@IDENTITY detection with ADO Pin
darkbyte24-Jul-04 10:49
darkbyte24-Jul-04 10:49 
GeneralRe: @@IDENTITY detection with ADO Pin
mav.northwind24-Jul-04 23:49
mav.northwind24-Jul-04 23:49 
Generalweekly,monthly and yearly report Pin
placement24-Jul-04 0:59
placement24-Jul-04 0:59 
GeneralUrgent! Need Help with SQL Statement Pin
bunnymaniac23-Jul-04 15:40
bunnymaniac23-Jul-04 15:40 
GeneralRe: Urgent! Need Help with SQL Statement Pin
Small Rat23-Jul-04 18:47
Small Rat23-Jul-04 18:47 
GeneralRe: Urgent! Need Help with SQL Statement Pin
bunnymaniac26-Jul-04 17:03
bunnymaniac26-Jul-04 17:03 
GeneralOLEDB question... Pin
CherezZaboro23-Jul-04 5:36
CherezZaboro23-Jul-04 5:36 
GeneralRe: OLEDB question... Pin
Mike Dimmick23-Jul-04 6:20
Mike Dimmick23-Jul-04 6:20 
GeneralRe: OLEDB question... Pin
CherezZaboro23-Jul-04 6:32
CherezZaboro23-Jul-04 6:32 
GeneralAnyone have any experience with FireBird Pin
partyganger22-Jul-04 17:45
partyganger22-Jul-04 17:45 
GeneralRe: Anyone have any experience with FireBird Pin
michanne124-Jul-04 6:51
michanne124-Jul-04 6:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.