Basil Hussain writes:
> Hi all,
>
> Is there any reason why I can't do something like any of the following?
>
> SET @blah := SHOW VARIABLES LIKE 'server_id';
> SHOW @blah := VARIABLES LIKE 'server_id';
>
> It doesn't seem to work no matter which combinations of syntax I try.
>
> Is setting user variables only supported via the SET and SELECT statements?
> I think it's a shame that setting variables from SHOW results is missing. I
> think that this functionality should be added to MySQL as it could be handy
> in some places.
>
> (For those who are wondering, I'm attempting to come up with a neat solution
> to avoid using auto-increment columns with co-replication between two MySQL
> servers. My idea was to have the server itself come up with a unique ID
> consisting of something like the current timestamp plus a random number plus
> the server's ID, rolled up into a concise hash value. My PHP script would
> perform a query like above when it first connects and then uses the saved
> user-variable in all subsequent queries where a unique ID is required.)
>
> Regards,
>
> Basil Hussain
> ---------------------------------------
> Internet Developer, Kodak Weddings
> E-Mail: [EMAIL PROTECTED]
Hi!
You can set variables to expressions only.
Setting them to queries will be possible when stored procedures are
implemented in about one year time.
--
Regards,
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Sinisa Milivojevic <[EMAIL PROTECTED]>
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, FullTime Developer
/_/ /_/\_, /___/\___\_\___/ Larnaca, Cyprus
<___/ www.mysql.com
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php