July 24, 2009 at 12:26 pm
Dear Friend,
i need your help...
which one SQL query gives me the Faster Output from below...
1). select Auditdata.* from auditdata auditdata
inner join Circlemaster c_mst on
auditdata.circlemaster_id<>C_mst.circlmaster_id
where tatcalltype is null
or
2). select Auditdata.* from auditdata auditdata
inner join Circlemaster c_mst on
auditdata.circlemaster_id not like C_mst.circlmaster_id
where tatcalltype is null
July 24, 2009 at 12:44 pm
Why don't you try them both and see?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
July 24, 2009 at 1:00 pm
Since you don't have any wildcards defined in the one using NOT LIKE, I would think that the optimzer would evaluate them the same, but as Gail said, "Try it and see".
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
July 24, 2009 at 1:02 pm
My concerns regard both is the possibility of extraneous data returned based on the joins.
July 24, 2009 at 1:58 pm
I've run into instances where and NOT LIKE are not necessarily the same (actually, = and LIKE). Here is an example, possibly more obscure than any real data. But, the point is that some Unicode characters seem to be treated as whitespace:DECLARE @S1 NVARCHAR(10)
DECLARE @S2 NVARCHAR(10)
SET @S1 = N'wedding ' + NCHAR(8238)
SET @S2 = N'wedding'
SELECT
CASE
WHEN @S1 = @S2
THEN 1
ELSE 0
END,
CASE
WHEN @S1 COLLATE SQL_Latin1_General_CP1_CI_AS = @S2 COLLATE SQL_Latin1_General_CP1_CI_AS
THEN 1
ELSE 0
END,
CASE
WHEN CAST(@S1 AS VARBINARY) = CAST(@S2 AS VARBINARY)
THEN 1
ELSE 0
END,
CASE
WHEN @S1 LIKE @S2
THEN 1
ELSE 0
END
July 24, 2009 at 3:12 pm
Lynn Pettis (7/24/2009)
My concerns regard both is the possibility of extraneous data returned based on the joins.
Yeah. That's one very strange join condition.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply