Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

Rewrite to Sargable
Is 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


Report this thread to moderator Post Follow-up to this message
Old Post
cbrichards via webservertalk.com
11-30-06 12:13 AM


Re: Rewrite to Sargable
For #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


Report this thread to moderator Post Follow-up to this message
Old Post
Tom Moreau
11-30-06 12:13 AM


RE: Rewrite to Sargable
Hi

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
>
>

Report this thread to moderator Post Follow-up to this message
Old Post
John Bell
12-01-06 12:14 AM


Sponsored Links





Last Thread Next Thread
Post New Thread

MS SQL Server archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 09:06 PM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006