Monday, 26 August 2013

How to insert a date that is 1 month prior to an existing date in Sybase Advantage Database using SQL?

How to insert a date that is 1 month prior to an existing date in Sybase
Advantage Database using SQL?

I have been asked to fill a field with date that is 1 month prior to a
date in a another field in our database. This would be like if the date is
1/16/13 I would then input into the new field the date of 12/16/12. The
issue that I ran into is that some functions that are normal to native SQL
databases do not exist in the same capacity in the Sybase Advantage
Database I am using. DATEADD for instance is not available from what I
have experienced thus far. So I have used the semi equivalent timestampadd
function. I started getting an error right when I thought I had it figured
out so here is where I feel the issue is, but I do not know what the issue
is:
INSERT INTO Normalization (memotext)
SELECT timestampadd(sql_tsi_month, -1, memotext)
FROM eqanswer
WHERE entityrole='MTG_PROP_FIGS'
and fieldnum=22
;
I keep getting this error: ERROR IN SCRIPT: poQuery: Error 7200: AQE
Error: State = S0000; NativeError = 2124; [iAnywhere Solutions][Advantage
SQL Engine]Invalid operand for operator:
Any help would be greatly appreciated! Thanks!

No comments:

Post a Comment