Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9314111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T02:03:18+00:00 2026-06-19T02:03:18+00:00

i need to INSERT data with date from a table to another table with

  • 0

i need to INSERT data with date from a table to another table with windows batch (.bat).

SET thedate='02/02/13'
mysql -e "INSERT INTO dest select str_to_date($thedate,'%d/%m/%Y') from source" thebase -uroot -ppassword`"

when i drag the .bat file to cmd window, the window show my code as :

SET thedate='02/02/13'
mysql -e "INSERT INTO dest select str_to_date($thedate,'m/Y') from source" thebase -uroot -ppassword"

the %d/%m/%Y has changed to m/Y so i get null value in table dest. When i run this query directly in phpmyadmin, it run well.

I use xampp 18.1 Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T02:03:19+00:00Added an answer on June 19, 2026 at 2:03 am

    In Windows batch, the syntax for variables is %foo%, not $foo. You’re probably confusing it with bash. As such:

    • $thedate is not a variable
    • %d/% is considered an unset d/ variable
    • the % in %Y is considered an unmatched variable delimiter and gets ignored

    You can escape % if you duplicate it:

    SET thedate='02/02/13'
    echo %thedate%,'%%d/%%m/%%Y'
    

    … prints:

    '02/02/13','%d/%m/%Y'
    

    I’d advise you against composing SQL strings through the command line interpreter if possible. It’s very difficult to get it right.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to insert data from table1 into table2. However, I would like to
Hi need insert data in table if the record is not already exits Ex:
I need to insert data into a column in the database. Which hook should
I need to insert a huge amount of data into different tables within my
i have asp.net project which has dropdownlist. i need to insert data into my
I am using an SQL query to insert data from an excel worksheet into
I have a MySQL insert query which needs to pull one data field from
I'm trying to create a function to insert data into a table. The query
I need to copy data from one database to another using a VB.NET program.
I have two table and I need to copy the data across from SRCServiceUsers

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.