[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

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

Posted on 2010-04-07
6
Medium Priority
?
287 Views
Last Modified: 2012-05-09


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 !!
0
Comment
Question by:kingjely
  • 4
5 Comments
 
LVL 8

Author Comment

by:kingjely
ID: 29996502
haha

SELECT CRC32(@inc:=@inc+1) as incrementcounter
0
 
LVL 8

Author Comment

by:kingjely
ID: 29996579
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
 
LVL 51

Accepted Solution

by:
Steve Bink earned 1500 total points
ID: 30081684
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
 
LVL 8

Author Comment

by:kingjely
ID: 30082041
cool thanks ill have a read!
0
 
LVL 8

Author Closing Comment

by:kingjely
ID: 32564123
Hi angel,

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

0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
Among the most obnoxious of Exchange errors is error 1216 – Attached Database Mismatch error of the Jet Database Engine. When faced with this error, users may have to suffer from mailbox inaccessibility and in worst situations, permanent data loss.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Hi, this video explains a free download that you can incorporate into your Access databases, or use stand-alone for contact management. Contacts -- Names, Addresses, Phone Numbers, eMail Addresses, Websites, Lists, Projects, Notes, Attachments…

640 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question