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

  • Home
  • SEARCH
  • 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 7900789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:03:15+00:00 2026-06-03T09:03:15+00:00

How to check if sql statement has been executing before executing another SQL statement.

  • 0

How to check if sql statement has been executing before executing another SQL statement.

I make like this

 DECLARE tempId double default 2;
 insert IGNORE  into  `system_users`( `user_id`,`username`,`password`) values (id , userName ,md5(password)) ;

  set tempId= last_insert_id();

  IF tempId <> 0 THEN     
        insert into  `user_profile`(`user_id`, `full_name`, `cellphone`, `Date_time_ added`,`added_by`) values (id, fullName ,cellPhone , CURRENT_TIMESTAMP(),addedBy ) ;

function last_insert_id() doesn’t work with my case because user_id is not auto increment pk, it’s the identification number fot the user. what is the function that is used to test execution of sql statement.

  • 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-03T09:03:17+00:00Added an answer on June 3, 2026 at 9:03 am

    You didn’t specify what DMBS you’re using so I’ll assume MySQL (it looks like MySQL to me, please specify if otherwise) For INSERT statements, use ROW_COUNT()

    E.g.

    DECLARE tempId double default 2;
     insert IGNORE  into  `system_users`( `user_id`,`username`,`password`) values (id , userName ,md5(password)) ;
    
    set tempId= ROW_COUNT();
    

    This will return the number of affected rows.

    Also, note that for SELECT statements, you would use FOUND_ROWS()

    e.g.

    SELECT SQL_CALC_FOUND_ROWS * FROM MyTable; 
    SELECT FOUND_ROWS();
    

    Although this will tell you the total number of rows found, regardless of whether or not you have a LIMIT clause.

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

Sidebar

Related Questions

In SQL, How we make a check to filter all row which contain a
I'm trying to check if a variable has been defined as a nullable Guid.
I need an SQL statement that check if one condition is satisfied: SELECT *
I'm looking for a way to poll different servers and check that SQL server
How can we check in a SQL Server WHERE condition whether the column is
I want to check in Transact SQL if a specific column in a table
I am running some tests with linq, how can I check what queries SQL
In SQL Server when I want to check performance, I clear all buffers -
In SQL Server you can use the IsNull() function to check if a value
In SQL Server, is there any way to check whether the changes in the

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.