I ran both syntaxes through every test I could find and there's no real
difference. The one altered by the server just looks 'wrong'. Why do the test
for itemnum in both options where a single call for it would be more efficient.
That's what threw me. There's no real need to alter the query.

> Michael,
>
> You right clicked on the table name  in Enterprise Manager, then clicked
> Open Table >> Query? Don't know why it changes the query.
>
> Why not try Query Analyzer instead? If you "SET SHOWPLAN_ALL on" you can
> easily compare several queries at once. In this case, your first query
> processes slightly faster.
>
> You can get the full scoop in SQL Books Online, under Contents. Go to
> Transact-SQL Reference. Expand SET and select SET SHOWPLAN_ALL.
>
> HTH,
> ~Dina
>
>
> ----- Original Message -----
> From: "Michael Dinowitz" <[EMAIL PROTECTED]>
> To: "SQL" <[EMAIL PROTECTED]>
> Sent: Saturday, June 28, 2003 10:31 PM
> Subject: SQL converted?
>
>
> > OK, I've got one query that was written by someone else that goes one way.
> When
> > I run it directly in the SQL2000 interface, it gets turned into the second
> > version below. Is the second more efficient? It doesn't look like it is...
> >  SELECT COUNT(itemnum) AS isComplete
> >         FROM items
> >        WHERE itemnum = 739434311
> >          AND (dynamic = 0 AND date_end <{ts '2003-06-28 23:12:47'} OR
> status =
> > 0)
> >
> >
> > SELECT     COUNT(itemnum) AS isComplete
> > FROM         items
> > WHERE     (itemnum = 739434311) AND (dynamic = 0) AND (date_end <
> > CONVERT(DATETIME, '2003-06-28 23:12:47', 102)) OR
> >                       (itemnum = 739434311) AND (status = 0)
> >
> > Bottom line question: Is the second query more efficient and why?
> > Thanks
> >
> > Michael Dinowitz
> > Finding technical solutions to the problems you didn't know you had yet
> >
> >
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=6
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=6

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

                        

Reply via email to