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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:12:01+00:00 2026-06-05T19:12:01+00:00

Using MySQL, How do I import a user defined database function from one db

  • 0

Using MySQL, How do I import a user defined database function from one db server to another db server using phpmyadmin?

A list of user defined functions can be fetched using this SQL:

select * from information_schema.routines;

Here is My function I want to move to a different database server:

CREATE DEFINER=`XXX`@`%` FUNCTION `BDayDiff`( d1 DATE, d2 DATE ) RETURNS int(11)
   DETERMINISTIC
BEGIN
 DECLARE dow1, dow2, days, wknddays INT;
 SET dow1 = DAYOFWEEK(d1);
 SET dow2 = DAYOFWEEK(d2);
 SET days = DATEDIFF(d2,d1);
 SET wknddays = 2 * FLOOR( days / 7 ) +
                IF( dow1 = 1 AND dow2 > 1, 1,                              
                    IF( dow1 = 7 AND dow2 = 1, 1,              
                        IF( dow1 > 1 AND dow1 > dow2, 2,      
                            IF( dow1 < 7 AND dow2 = 7, 1, 0 )  
                          )
                      )
                  );
 RETURN FLOOR(days - wkndDays);
END

But I get an error:

Error

SQL query:

CREATE DEFINER = `XXX`@`%` FUNCTION `BDayDiff` (
d1 DATE,
d2 DATE
) RETURNS INT( 11 ) DETERMINISTIC BEGIN DECLARE dow1,
dow2,
days,
wknddays INT;

MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that 
corresponds to your MySQL server version for the right syntax to use 
near '' at line 5 
  • 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-05T19:12:03+00:00Added an answer on June 5, 2026 at 7:12 pm

    Hope this is possible in phpmyadmin:

    • Execute SHOW CREATE FUNCTION
    • You will see CREATE FUNCTION statement, execute it against another MySQL server
    • Repeat this steps for each function.

    Note, that functions may have security options (DEFINER, SQL SECURITY), read about these options in the documentation (CREATE PROCEDURE and CREATE FUNCTION Syntax); if you want to use them, check that specified users are created on another server.

    SHOW CREATE FUNCTION Syntax.

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

Sidebar

Related Questions

I have created one database in mysql server 5.0.How i can import this database(I
MySQL ResultSets are by default retrieved completely from the server before any work can
Using the following import groovy.sql.Sql def sql = Sql.newInstance(jdbc:mysql://localhost:3306/eventDb, user, pwd, com.mysql.jdbc.Driver) def sqlInsert
I'm using mysql-python . Here's my settings.py import os, sys abspath = lambda *p:
I am using MySQL for my database. I have a requirement to store a
I'm using MySQL API's function mysql_real_escape_string() Based on the documentation, it escapes the following
I'm now using this code to import csv data into my database.(Thanks to Francis
I was trying to access the mysql databases from server A to server apple
I'm attempting to load a User object from mysql but I keep getting UnboundExecutionError:
i'm trying to develop a client-server chat application using java servlets and mysql(innoDB engine)

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.