same query, different behavior on different networks

  • Hello, 

    I have a scenario where a  query should bring all names that match a criteria entered on a screen. as an example, if I type  "Smi", should bring all people with last name starting with "Smi'. 
    I use the same copy of the database in two different networks and only in one of them will bring all the records, but in the other one only bring one record.

    Environments:
    SQL 2008 and 2012, windows 10, windows 8 and windows 7.  

    I've tried all these combinations in both networks and still only work in one but not in the other. 
    I thought that maybe could be index related, but I copy the same db from one environment to the other and now I'm not even sure what else I should check.

    Any thought and point will be really appreciated. 

    Thanks  in advance

  • Have you verified that the table in both "networks" has the same number of rows and have the exact same rows?  I know you say you use the same copy but you've not identified how you made the copy.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Hi pamenta,

    You say the query should bring up all names that match "a criteria entered on a screen"; what do you mean by this? Is this query being run from SQL Server Management Studio? In a custom application? My first step here would be to run SQL Profiler against each database while you're running that query to see if there is a difference in what is being sent to the database.

    If the query being executed is the same, it would help to post an example of the query (and perhaps some sample data).  Please also check whether the statements below return the same results when ran against both servers.


    select SERVERPROPERTY ('Collation'); 
    select @@LANGUAGE;

    Andrew

  • pamenta - Sunday, February 5, 2017 9:54 AM

    Hello, 

    I have a scenario where a  query should bring all names that match a criteria entered on a screen. as an example, if I type  "Smi", should bring all people with last name starting with "Smi'. 
    I use the same copy of the database in two different networks and only in one of them will bring all the records, but in the other one only bring one record.

    Environments:
    SQL 2008 and 2012, windows 10, windows 8 and windows 7.  

    I've tried all these combinations in both networks and still only work in one but not in the other. 
    I thought that maybe could be index related, but I copy the same db from one environment to the other and now I'm not even sure what else I should check.

    Any thought and point will be really appreciated. 

    Thanks  in advance

    Can you please post the actual query?
    😎

  • Jeff Moden - Sunday, February 5, 2017 11:08 PM

    Have you verified that the table in both "networks" has the same number of rows and have the exact same rows?  I know you say you use the same copy but you've not identified how you made the copy.

    Hi Jeff,
    Thanks for your post.  I just backup the db in one environment and restore it on the other environment.

  • Andrew P - Sunday, February 5, 2017 11:38 PM

    Hi pamenta,

    You say the query should bring up all names that match "a criteria entered on a screen"; what do you mean by this? Is this query being run from SQL Server Management Studio? In a custom application? My first step here would be to run SQL Profiler against each database while you're running that query to see if there is a difference in what is being sent to the database.

    If the query being executed is the same, it would help to post an example of the query (and perhaps some sample data).  Please also check whether the statements below return the same results when ran against both servers.


    select SERVERPROPERTY ('Collation'); 
    select @@LANGUAGE;

    Andrew

    Thanks for the suggestion Andrew, 
    I will get  answer as soon as I can get to the other environment.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply