date format problem

  • I have 3 SQL Server 2000 with a merge replication between them. On 2 servers, everything goes fine. On the third, my client is unable to get the reports from our VB application when they specify dates.

    Regional settings on all servers are US with date format set to M/D/yyyy

    Query from our application, taken from Profiler, is:

    exec PS_recRapportInventaireDetailled_sel '102', '102', '', '', '', '', '', '', '', '', '2011/03/08 00:00:00', '2011/03/08 23:59:59', '', '', '06', '06', '', '', '', '', '', '', '', '', '2', '', ''

    when executed on the 2 first servers, it works fine. on the third server, it give nothing.

    On this server, I tried those queries in Query Analyzer:

    select * from tb_recReceptionLot

    where recdate > '2011-03-08 00:00:00'

    -> give nothing

    select recBon, recDate from tb_recReceptionLot

    order by recDate desc

    -> give the following:

    recBon recDate

    ---------- ------------------------------------------------------

    1184799854 2011-03-08 10:30:55.310

    KSP102 2011-03-08 10:29:53.110

    1184799854 2011-03-08 10:28:59.773

    P0 2011-03-08 10:28:21.540

    1184699854 2011-03-08 10:27:12.943

    MAJ102 2011-03-08 10:26:54.047

    102 2011-03-08 10:23:36.873

    SPJ102 2011-03-08 10:23:17.813

    SPJ102 2011-03-08 10:22:02.767

    06110163 2011-03-08 10:21:32.073

    why does the second select gives correct result and the first query give nothing? I really don't understand where is the problem.

    thanks for your time and help

  • Sounds like regional settings but you said you double checked them.

    what is the result from:

    select CAST('2011-03-08 00:00:00' as datetime)

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • yes it works like this.

    but it should work with the stored proc (exec PS_.....) without having to change anything in the code, as it works fine elsewhere...

Viewing 3 posts - 1 through 3 (of 3 total)

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