MySql assigning a View a random name as to not clash with a constant name value



Using SELECT CRC32('randomnamevalue')

Is anyone clever enough to use the above to assign a VIEW or TEMPORARY TABLE a random name

@randomname:=@randomname + select CRC32('randomname');
alter view @randomname as
 SELECT* from customers ;

I want to auto generate a VIEW name or TEMPORARY Table name , instead of having to give it a static name

Most likely impossible, but im going to ask anyway !!
LVL 8
kingjelyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kingjelyAuthor Commented:
haha

SELECT CRC32(@inc:=@inc+1) as incrementcounter
0
kingjelyAuthor Commented:
so this gives me a random number each time i press enter so maybe i can use this as a name of a VIEW?
0
Steve BinkCommented:
What are you using to create the view?  This is simple enough to do in any server-side or compiled language.  If you are trying to do this from inside a stored procedure, generate dynamic SQL to make it happen.  See here for a full example:

http://www.java2s.com/Code/SQL/Procedure-Function/EXECUTEdynamicSQLcommand.htm
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kingjelyAuthor Commented:
cool thanks ill have a read!
0
kingjelyAuthor Commented:
Hi angel,

Thanks for this,
Have been learning how to create procedures.

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.