Search
 
SCRIPT & CODE EXAMPLE
 

SQL

mysql create procedure phpmyadmin

delimiter //
CREATE PROCEDURE insert_user_temp()
 BEGIN 
  DECLARE row_coun_no INT;
  SELECT COUNT(`id`) INTO row_coun_no FROM user_temp;
  IF row_coun_no != 0 THEN
    TRUNCATE `user_data`;
    INSERT INTO user_data (employee_id,employee_code,employment_type,`emp_name`,first_name,middle_name,last_name,photo_file_name,email_id)
    SELECT employee_id,`employee_code`,`employment_type`,CONCAT(`first_name`," ",`last_name`),`first_name`,`middle_name`,`last_name`, `email_id`, `photo_file_name` FROM `user_temp`;
    TRUNCATE user_temp;
    UPDATE  `demo_user`.`tbl_users`, `main_user`.`user_data` SET tbl_users.profile_pic = user_data.photo_file_name
    WHERE  tbl_users.email = user_data.email_id;
  END IF;
END;//

delimiter ;
Comment

PREVIOUS NEXT
Code Example
Sql :: FIND AVERAGE SALARY EARNER IN SQL 
Sql :: mysql vs postgresql 
Sql :: q operator in sql 
Sql :: mysql set boolean default value 
Sql :: oracle dependencies table 
Sql :: Save PL/pgSQL output from PostgreSQL to a CSV file 
Sql :: sql download for windows 10 
Sql :: how to find all children of a record with only parent ID in sql 
Sql :: mysql select date from datetime 
Sql :: sql get duplicates by composite 
Sql :: mysql order by date asc null last 
Sql :: codeigniter get sql query string 
Sql :: rename column mysql 
Sql :: how to upper case in sql 
Sql :: move table to a different schema 
Sql :: oracle select row max date 
Sql :: sql sequence 
Sql :: print hello world in sql 
Sql :: sql create tabel with primary key auto_increment code 
Sql :: oracle right characters 
Sql :: sqlalchemy get schema from database 
Sql :: How to get last inserted primary key in SQL Server 
Sql :: update select mysql 
Sql :: sql find leading space 
Sql :: how to define a save method in ruby for sqlite3 databases 
Sql :: unique in sql server 
Sql :: show function mysql 
Sql :: on update current_timestamp jpa 
Sql :: mysql grant user permissions 
Sql :: how to get max from each department in sql 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =