Tuesday, 15 April 2014

php - SQL Server outputs inconsistent data -


I'm getting strange results for this query.

  & lt;? ('Conf / conector.php'); Echo "start"; $ ConnSQL = mssql_connect ($ AconnSQL [$ CONF_connSQL_default] [1], $ AconnSQL [$ CONF_connSQL_default] [2], $ AconnSQL [$ CONF_connSQL_default] [3]); Mssql_select_db ($ AconnSQL [$ CONF_connSQL_default] [4], $ connSQL); $ Result = mssql_query ("Select top 300 codem, descripcion, from codsbr item (NOLOCK) with WHERE itemprefi = 'B' and descripcion! = '' And descripcion is not"); Echo "& lt; br & gt; Rows:" .mssql_num_rows ($ result). '& Lt; Br> & # 39; & # 39; Mssql_free_result ($ result); Mssql_close ($ connSQL); Repeat "End"; Included ('../ included / funciones / conector_by.php'); ? & Gt;  

The code above is expected because of "Top 300" "Lines: 300" prints.

But if I run (using the same code):

  SELECT Coditm, descripcion, from codsbr item (NOLOCK) This item "F" = "B" And descripcion! = '' And not descripcion  

This prints the "Rows: 272" (I get 272 lines if I 'mscllftrearAr'

If I " Top 500 ", I also get 272 lines.

It's just crazy but it goes crazy ...

If I go:

Items with test from SELECT SELECT SELECT (*) (NOLOCK) WHERE itemprefi = 'B' and descripcion! = '' And do not descripcion

Test column is 1936 (which is the habit of rows

I am totally confused, I do not know where to find an error I am using mssql_ * for a long time (in the same server) and I have not found a problem like this, it works only with this table.


No comments:

Post a Comment