Drop Table
Support Forum for database administrators and web based access to important newsgroups related to databasesIs there a way to rewrite either of the following where clause items to allo w them to be SARGABLE? 1. ISDATE(Team.TextValue) = 1 -- Ensure that the value in the TextValue field is a date. TextValue datatype is varchar(25). 2. LEFT(Team.Codes, 1) <> '-' -- Exclude the Codes that begin with a '-'. Codes datatype is varchar(10). -- Message posted via http://www.webservertalk.com
Post Follow-up to this messageFor #2, try: Team.Codes not like '-%' -- Tom ---------------------------------------------------- Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS SQL Server MVP Toronto, ON Canada . "cbrichards via webservertalk.com" <u3288@uwe> wrote in message news:6a089625d4de6@u we... Is there a way to rewrite either of the following where clause items to allow them to be SARGABLE? 1. ISDATE(Team.TextValue) = 1 -- Ensure that the value in the TextValue field is a date. TextValue datatype is varchar(25). 2. LEFT(Team.Codes, 1) <> '-' -- Exclude the Codes that begin with a '-'. Codes datatype is varchar(10). -- Message posted via http://www.webservertalk.com
Post Follow-up to this messageHi For #1 If Team.TextValue should only be dates, you may want to validate it on the UI. If it can be dates and other entries you may want to hold a datetype fla g instead. John "cbrichards via webservertalk.com" wrote: > Is there a way to rewrite either of the following where clause items to al low > them to be SARGABLE? > > 1. ISDATE(Team.TextValue) = 1 -- Ensure that the value in the TextValue > field is a date. TextValue datatype is varchar(25). > > 2. LEFT(Team.Codes, 1) <> '-' -- Exclude the Codes that begin with a '-' . > Codes datatype is varchar(10). > > -- > Message posted via http://www.webservertalk.com > >
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread