Forum Discussion
Anonymous
7 years agoNot applicable
SQL Query with Actual Date
Hello, I Have a question. What must I write in the M Statement or SQL Statment to get WHERE explicit Date to NOW Date? Quelle = Odbc.Query("dsn=mmStatistik", "SELECT * FROM mmstatistik#(I...
- Anonymous7 years ago
SELECT * FROM mmstatistik WHERE belegdatum BETWEEN {d '01/01/2018'} AND Date()was rellay simple...and a lucky type...
that works and gives me the actual date
Thanks for alle the help and sorry for the circumstances.
richardverburg
7 years agoHelper I
Sure:
FORMAT ( getdate(), 'd', 'de-de' )
More information: https://docs.microsoft.com/en-us/sql/t-sql/functions/format-transact-sql?view=sql-server-2017
Anonymous
7 years agoNot applicable
SELECT * FROM mmstatistik WHERE belegdatum BETWEEN convert(date, format(getdate()-10, 'd', 'de-de')) AND convert(date, format(getdate(), 'd', 'de-de'))
still that error :(
- richardverburg7 years agoHelper I
What is your source database? Not mssql right? that was my assumption
- richardverburg7 years agoHelper I
Dont use the convert function. The format made a string value of the date so that wont work.
SELECT
format(getdate()-10, 'd', 'de-de')
, format(getdate(), 'd', 'de-de') - Anonymous7 years agoNot applicable
SELECT * FROM mmstatistik WHERE belegdatum BETWEEN format(getdate()-10, 'd', 'de-de') AND format(getdate(), 'd', 'de-de')
still...
SpoilerDataSource.Error: ODBC: ERROR [HY000] [SAP][Advantage SQL Engine][ASA] Error 7200: AQE Error: State = S0000; NativeError = 2158; [SAP][Advantage SQL Engine]Scalar function not found: getdate -- Location of error in the SQL statement is: 60 (line: 4 column: 16)
Details:
DataSourceKind=Odbc
DataSourcePath=dsn=mmStatistik
OdbcErrors=Tableguess that GetDate() is not implementet or something :(
- Anonymous7 years agoNot applicable
SELECT * FROM mmstatistik WHERE belegdatum BETWEEN {d '01/01/2018'} AND Date()was rellay simple...and a lucky type...
that works and gives me the actual date
Thanks for alle the help and sorry for the circumstances.