SQL Statement Date Format

Posted by afuchs on 05-Dec-2013 04:39

Hello,

we are using proALPHA and Progress 10.2 B

i want to trasfer some Data from the Progress to an MS SQL Server 2005 (German version Collation Latin1_General_CI_AS)

I use ODBC and a linked Server to the Progress

Here my Statement

declare @heute as varchar(10)
select @heute = substring(CONVERT(varchar(10), dateadd(dd,-3,getdate()), 104),1,2) + '.' + substring(CONVERT(varchar(10), dateadd(dd,-3,getdate()), 104),4,2) + '.' + substring(CONVERT(varchar(10), dateadd(dd,-3,getdate()), 104),7,4)

select auftragsnr, offen, anlagebenutzer, substring(anlage_datum,4,2) + '.' + substring(anlage_datum,1,2) + '.' + substring(anlage_datum,7,4), anlagezeit FROM OpenQuery([PA_TEST2], 'select auftragsnr, anlagebenutzer, TO_CHAR(anlagedatum) as anlage_datum, offen, anlagezeit from pub.V_BelegKopf where firma = ''222'' and belegart = ''U'' and anlagebenutzer = ''batch'' and offen = 1 and TO_CHAR(anlagedatum) = ''" + @heute + "'' and anlagezeit > ''00:00:00''') where auftragsnr not in (SELECT auftragsnr from pa_orders)

i think the dateformat will be not korrekt. i dont get records back (the result is empty) i cant use "anlagedatum = today" because the sql server reqest an error.

Can someone help???

thanks Andreas

All Replies

Posted by gus on 06-Dec-2013 10:20

the code is difficult for me to understand. without knowing the data types you are reading and what the data values in them look like, it is impossible to say why you get unexpected results

This thread is closed