March 2, 2009 at 6:44 am
I have Stored procedure and after running it i am getting different results as when i run from Query Analyzer.
I have found that the problematic part can be part with the second cursor.
any general thoughts?
March 2, 2009 at 6:47 am
alstar (3/2/2009)
any general thoughts?
Without seeing the code, no.
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
March 2, 2009 at 6:54 am
ok i think i have found the problem but i need confirmation from you guys.
UPDATE #temp set BasketCost=0 WHERE DeliveryChargeID = @LinkedUserDeliveryChargeID
this code set BasketCost to 0 in SP, but not in QA.
Both values are NULL
QA did correct job when was comparing NULL = NULL, and didnt set BasketCost to 0, but SP did as it executed NULL = NULL as true...
what should I do? use `LIKE` instead of `=` ?
or maybe .... WHERE DeliveryChargeID = @LinkedUserDeliveryChargeID AND LinkedUserDeliveryChargeID IS NOT NULL....
March 2, 2009 at 7:13 am
alstar (3/2/2009)
so my question is, QA did correct job when was comparing NULL = NULL, and didnt set BasketCost to 0, but SP did as it executed NULL = NULL as true...
Check the ANSI_NULL settings.
As for which is right, only you can answer that one. Like behaves the same as = with regard to nulls
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
March 4, 2009 at 12:11 am
WHERE (a ISNULL AND b ISNULL)
--Jeff Moden
Change is inevitable... Change for the better is not.
March 4, 2009 at 12:28 am
WHERE (a IS NULL AND b IS NULL)
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
March 4, 2009 at 12:32 am
Heh... I shouldn't post so late at night... I forgot the bloody spaces. :hehe:
--Jeff Moden
Change is inevitable... Change for the better is not.
March 4, 2009 at 12:36 am
Jeff Moden (3/4/2009)
Heh... I shouldn't post so late at night... I forgot the bloody spaces. :hehe:
Sleep, yes good it would be.
March 4, 2009 at 1:04 am
Jeff Moden (3/4/2009)
Heh... I shouldn't post so late at night... I forgot the bloody spaces. :hehe:
Howcanyouforgetthespaces?
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
March 4, 2009 at 6:04 am
GilaMonster (3/4/2009)
Jeff Moden (3/4/2009)
Heh... I shouldn't post so late at night... I forgot the bloody spaces. :hehe:Howcanyouforgetthespaces?
heh.BecauseAllMyVariablesAndColumnNamesAreMixedCaseAndItsBecomeAHabit. 😛
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 10 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply