0

I want to convert SQL Server table data to .DBF file.

Below query is working without date. But when I add date it's not working. Please solve my issue, thanks in advance.

Without date:

INSERT INTO Fe130328.DBF (LINENO, BOOK, VCHSERIES, VCHNO, ACCODE, ACHEAD, CITY, NARRATION, DEBIT,CREDIT) 
VALUES ('" & str_sr_no & "','" & str_book & "','" & str_vchseries & "','" & str_vchno & "','" & str_accode & "','" & str_achead & "','" & str_city & "','" & str_narration & "','" & str_debit & "','" & str_credit & "')"

With date:

INSERT INTO Fe130328.DBF (LINENO, DATE, BOOK, VCHSERIES, VCHNO, ACCODE, ACHEAD, CITY, NARRATION, DEBIT, CREDIT) 
VALUES ('" & str_sr_no & "','21/07/2020','" & str_book & "','" & str_vchseries & "','" & str_vchno & "','" & str_accode & "','" & str_achead & "','" & str_city & "','" & str_narration & "','" & str_debit & "','" & str_credit & "')"
1
  • SQL Injection alert - you should NEVER EVER concatenate together your SQL statements - use parametrized queries instead to avoid SQL injection - check out Little Bobby Tables Commented Aug 1, 2020 at 5:20

1 Answer 1

1

Date value should be MM/DD/YYYY format. Just make change Date format and use following query.

INSERT INTO Fe130328.DBF (LINENO, DATE, BOOK, VCHSERIES, VCHNO, ACCODE, ACHEAD, CITY, NARRATION, DEBIT, CREDIT) 
VALUES ('" & str_sr_no & "','07/21/2020','" & str_book & "','" & str_vchseries & "','" & str_vchno & "','" & str_accode & "','" & str_achead & "','" & str_city & "','" & str_narration & "','" & str_debit & "','" & str_credit & "')"
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for reply, Error Msg. Syntax error in INSERT INTO statement.
It`s OK. but if you got help then you may upvote also.

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.