0

Could someone please take a look at the script below and tell me why it errors out? It's coming out of db2 (via Razor SQL) and I have been able to correct all the the other erros but I can't figure this one out. It's going into MYSQL. (latest version)

CREATE TABLE APCHECKIN (
    CHKBCH_NO INTEGER NOT NULL,
    ENTERDATETIME TIMESTAMP DEFAULT CURRENT TIMESTAMP NOT NULL,
    VENDOR_NO INTEGER DEFAULT 0 NOT NULL,
    INVOICE_NO VARCHAR(18) NOT NULL,
    CHK_NO INTEGER,
    PAIDAMOUNT DECIMAL(14,2) DEFAULT 0 NOT NULL,
    PRIMARY KEY (CHKBCH_NO,ENTERDATETIME,VENDOR_NO,INVOICE_NO)
);

This is the error I get. I'm assuming it's something to do with the timestamp I'm just overlooking it!

Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CURRENT TIMESTAMP NOT NULL,
    VENDOR_NO INTEGER DEFAULT 0 NOT NULL,
    INVOICE_NO V' at line 3

Thanks for any help!

1 Answer 1

2

You need an underscore in CURRENT_TIMESTAMP

CREATE TABLE APCHECKIN (
    CHKBCH_NO INTEGER NOT NULL,
    ENTERDATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
    VENDOR_NO INTEGER DEFAULT 0 NOT NULL,
    INVOICE_NO VARCHAR(18) NOT NULL,
    CHK_NO INTEGER,
    PAIDAMOUNT DECIMAL(14,2) DEFAULT 0 NOT NULL,
    PRIMARY KEY (CHKBCH_NO,ENTERDATETIME,VENDOR_NO,INVOICE_NO)
);

http://sqlfiddle.com/#!2/92758

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the quick reply! It worked great! I figured it was something stupid like that!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.