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 7794611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:49:30+00:00 2026-06-01T22:49:30+00:00

I have a MySQLvariable @query = CONCAT(‘INSERT INTO history VALUES (‘,1,’,’,50,’,UTC_TIMESTAMP()’); I want to

  • 0

I have a MySQLvariable

@query = CONCAT('INSERT INTO history VALUES (',1,',',50,',UTC_TIMESTAMP()');

I want to execute the insert statement present in the variable.

  • 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-01T22:49:32+00:00Added an answer on June 1, 2026 at 10:49 pm

    You must first prepare the statement using PREPARE and then use EXECUTE

    See here: http://dev.mysql.com/doc/refman/5.0/en/sql-syntax-prepared-statements.html

    Something like:

    SET @query = CONCAT("INSERT INTO history VALUES (",1,",",50,",UTC_TIMESTAMP()");
    
    PREPARE stmt1 FROM @query; 
    EXECUTE stmt1; 
    DEALLOCATE PREPARE stmt1; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have added the following code to my SQL query: (Note cut down version) DECLARE
Have finally got a responsive site working (of a fashion). What I want to
Have just got a surprise and would appreciate some suggestions. The simple query below
Have a query that should hopefully be nice and simple to answer. I have
Have a numeric nvarchar values with some extra-symbols For example 1/2, 9/6, 14A They
Have a problem with agsXMPP. What I want to do, is connect to openfire
Have just started to get into CakePHP since a couple of weeks back. I
have written this little class, which generates a UUID every time an object of
Have a procedure which looks like Procedure TestProc(TVar1, TVar2 : variant); Begin TVar1 :=
Have done quite a bit of searching for a guide (of any substance) for

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.