Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Strored procedure returns different row counts Expand / Collapse
Author
Message
Posted Sunday, January 27, 2013 6:21 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Sunday, March 31, 2013 10:55 AM
Points: 12, Visits: 252
I have a Select statement based on few joins. When I run it on my development server and test development server, I am getting different rowcounts. I have looked at each table from the two environments in the join clause and they all have records in them. Some of the columns in the table have null values. Any clues/suggestions why this is occurring will be great

Thanks



Post #1412118
Posted Sunday, January 27, 2013 6:37 AM


UDP Broadcaster

UDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP Broadcaster

Group: General Forum Members
Last Login: Today @ 2:39 PM
Points: 1,456, Visits: 14,268
Alex koranteng (1/27/2013)
I have a Select statement based on few joins. When I run it on my development server and test development server, I am getting different rowcounts. I have looked at each table from the two environments in the join clause and they all have records in them. Some of the columns in the table have null values. Any clues/suggestions why this is occurring will be great

Thanks



its a bit difficult to help you....I cant see what you can see....perhaps if you gave us the code for your proc and some example data and expected results...we may be able to help

if you are unsure how to provide this...please post back...I assume you are using SQL 2005 ?

regards


__________________________________________________________________
you can lead a user to data....but you cannot make them think !
__________________________________________________________________
Post #1412121
Posted Sunday, January 27, 2013 6:49 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Sunday, March 31, 2013 10:55 AM
Points: 12, Visits: 252
Thanks for the prompt response. It will hard for me to send you my script and data because of privacy concerns of my company. I just need some high level reasons why I am getting this lkind of behaviour.
The sproc is giving different row counts between the development and test servers.

Thanks



Post #1412122
Posted Sunday, January 27, 2013 6:59 AM


UDP Broadcaster

UDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP Broadcaster

Group: General Forum Members
Last Login: Today @ 2:39 PM
Points: 1,456, Visits: 14,268
my first thought is that the data in the tables is different between servers...but I would have thought you had already checked this?



__________________________________________________________________
you can lead a user to data....but you cannot make them think !
__________________________________________________________________
Post #1412123
Posted Sunday, January 27, 2013 7:05 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 3:28 PM
Points: 37,730, Visits: 29,996
Alex koranteng (1/27/2013)
The sproc is giving different row counts between the development and test servers.


The data is different or the code is different. Can't really say much more without more details



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1412124
Posted Sunday, January 27, 2013 7:40 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Sunday, March 31, 2013 10:55 AM
Points: 12, Visits: 252
Thanks for the pointer. The code is the same. The data for the joins in the two environments are slightly different, because the test server data is a restore of production data, but most of the tables in the two environments have similar record count. Could it be due to the environment settings between the two environments.




Post #1412127
Posted Sunday, January 27, 2013 7:55 AM


UDP Broadcaster

UDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP Broadcaster

Group: General Forum Members
Last Login: Today @ 2:39 PM
Points: 1,456, Visits: 14,268
Alex koranteng (1/27/2013)
Thanks for the pointer. The code is the same. The data for the joins in the two environments are slightly different, because the test server data is a restore of production data, but most of the tables in the two environments have similar record count. Could it be due to the environment settings between the two environments.



ok..so the code is the same but the data is "slightly different"......in which case I would expect to get different results....why are you expecting the same results?

without more details sample code and sample data that demonstrates your problem, I dont see how I can help.


__________________________________________________________________
you can lead a user to data....but you cannot make them think !
__________________________________________________________________
Post #1412128
Posted Monday, January 28, 2013 9:32 AM


Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Monday, May 20, 2013 6:54 PM
Points: 721, Visits: 1,375
Alex koranteng (1/27/2013)
Thanks for the pointer. The code is the same. The data for the joins in the two environments are slightly different, because the test server data is a restore of production data, but most of the tables in the two environments have similar record count. Could it be due to the environment settings between the two environments.



You mentioned in your OP that some of the columns in the tables involved have NULL values in them. If you are joining or filtering on any of those columns, different ANSI_NULLS settings could return different results.

Of course, as others have mentioned, trying to diagnose this problem without ensuring that the data is IDENTICAL (not "similar") in both environments will open up many rabbit holes that have nothing to do with the actual cause of the different results. For your own sake, don't waste time like that. If you can't make the data identical in each environment, first spend your time breaking down the query and examining the underlying data to be sure that differences in the data aren't leading to different (but correct for each environment) query results.
Post #1412506
Posted Monday, January 28, 2013 8:26 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Sunday, March 31, 2013 10:55 AM
Points: 12, Visits: 252
Thanks for the pointer



Post #1412732
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse