Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • INSERT(str,pos,len,newstr) MySQL function

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 545
    Comment on it

    INSERT(str,pos,len,newstr)

    If you want to insert a string inside another string then you can use this MySQL INSERT function. INSERT returns the string str, with the substring beginning at position pos and len characters long replaced by the string newstr. This returns the original string if pos is not within the length of the string and replaces the rest of the string from position pos if len is not within the length of the rest of the string. And if the argument is NULL then Inset returns NULL.

    Here are some example to clear INSERT MySQL function-

    mysql> SELECT INSERT('Hello, Welcome to MySQL',3,10,'NEW STRING');
    +-----------------------------------------------------+
    | INSERT('Hello, Welcome to MySQL',3,10,'NEW STRING') |
    +-----------------------------------------------------+
    | HeNEW STRINGme to MySQL                             |
    +-----------------------------------------------------+
    1 row in set (0.00 sec)
    
    mysql> SELECT INSERT('Hello, Welcome to MySQL',-1,10,'NEW STRING');
    +------------------------------------------------------+
    | INSERT('Hello, Welcome to MySQL',-1,10,'NEW STRING') |
    +------------------------------------------------------+
    | Hello, Welcome to MySQL                              |
    +------------------------------------------------------+
    1 row in set (0.00 sec)
    
    mysql> SELECT INSERT('Hello, Welcome to MySQL',3,100,'NEW STRING');
    +------------------------------------------------------+
    | INSERT('Hello, Welcome to MySQL',3,100,'NEW STRING') |
    +------------------------------------------------------+
    | HeNEW STRING                                         |
    +------------------------------------------------------+
    1 row in set (0.00 sec)
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: