Professional Web Applications Themes

concat strings in stored procedure - MySQL

Hi, I have created a stored procedure in which I want to create a table. The procedure has some parameters, one of them I want to use for the table name. The table name should be dynamically put together like `parameter + static name` How can I do that? Yours sincerely Peter...

  1. #1

    Default concat strings in stored procedure

    Hi,

    I have created a stored procedure in which I want to create a table.
    The procedure has some parameters, one of them I want to use for the table
    name.
    The table name should be dynamically put together like
    `parameter + static name`

    How can I do that?


    Yours sincerely

    Peter



    Peter Guest

  2. #2

    Default Re: concat strings in stored procedure

    SELECT CONCAT(title, ' is in ', book) FROM MyTable

    --

    Jack Vamvas
    ___________________________________
    Need an IT job? http://www.ITjobfeed.com/mysql

    <a href="http://www.itjobfeed.com/mysql"> mysql it jobs</a>



    "Peter Ludwig" <de> wrote in message
    news:f1ujkf$bt8$de... 


    Jack Guest

  3. #3

    Default Re: concat strings in stored procedure

    On 10 May, 11:10, "Jack Vamvas" <com> wrote: 




    >
    > - Show quoted text -[/ref]

    That's not exactly what he asked is it?

    Captain Guest

  4. #4

    Default Re: concat strings in stored procedure

    On 10 May, 09:02, "Peter Ludwig" <de> wrote: 

    Clues to how to do it can be found here:
    http://groups.google.co.uk/group/comp.databases.mysql/browse_frm/thread/860e02de891d4a3/d11d18a5b74358df?lnk=gst&q=table+name+stored&rnum= 5#d11d18a5b74358df

    Captain Guest

  5. #5

    Default Re: concat strings in stored procedure


    "Captain Paralytic" <com> schrieb im Newsbeitrag
    news:googlegroups.com... 
    >
    > Clues to how to do it can be found here:
    > http://groups.google.co.uk/group/comp.databases.mysql/browse_frm/thread/860e02de891d4a3/d11d18a5b74358df?lnk=gst&q=table+name+stored&rnum= 5#d11d18a5b74358df
    >[/ref]


    Hi,

    thanks for the link.
    I had just a short look, but I guess this is exactly what I've looking for.

    Peter


    Peter Guest

  6. #6

    Default Re: concat strings in stored procedure

    On 10 May, 12:40, "Peter Ludwig" <de> wrote: [/ref]
    > [/ref]
    > [/ref]
    > [/ref]
    > [/ref]

    >
    > Hi,
    >
    > thanks for the link.
    > I had just a short look, but I guess this is exactly what I've looking for.
    >
    > Peter- Hide quoted text -
    >
    > - Show quoted text -[/ref]

    Shucks! I can't take all the credit, I just googled this group!

    Captain Guest

  7. #7

    Default Re: concat strings in stored procedure


    "Peter Ludwig" <de> schrieb im Newsbeitrag
    news:f1v0bi$r30$de... 
    >>
    >> Clues to how to do it can be found here:
    >> http://groups.google.co.uk/group/comp.databases.mysql/browse_frm/thread/860e02de891d4a3/d11d18a5b74358df?lnk=gst&q=table+name+stored&rnum= 5#d11d18a5b74358df
    >>[/ref]
    >
    >
    > Hi,
    >
    > thanks for the link.
    > I had just a short look, but I guess this is exactly what I've looking
    > for.
    >
    > Peter
    >[/ref]

    Yes, it helped me to solve my problem.
    thank you very much

    my little example:

    set statement = Concat("DROP TABLE IF EXISTS `", 'table', salesmanID,
    "`;");
    PREPARE stmt FROM statement;
    Execute stmt;

    set statement = Concat("
    CREATE TABLE `", 'table', salesmanID,"` (
    `pg_id` int(11) NOT NULL auto_increment,
    `pg_created` datetime default NULL,
    `pg_func` mediumtext,
    PRIMARY KEY (`pg_id`)
    ) ENGINE=MyISAM DEFAULT CHT=utf8 AUTO_INCREMENT=0 ;");

    PREPARE stmt FROM statement;
    Execute stmt;


    Peter Guest

Similar Threads

  1. SQL Stored Procedures and Lists of Strings
    By Adam72 in forum Coldfusion Database Access
    Replies: 6
    Last Post: February 28th, 03:20 AM
  2. Using a stored procedure
    By MarkWright in forum Coldfusion Database Access
    Replies: 13
    Last Post: April 15th, 05:53 PM
  3. help with a stored procedure
    By Jason Tesser in forum PostgreSQL / PGSQL
    Replies: 1
    Last Post: January 3rd, 05:35 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139