This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have a function that returns me a random number, which this random number is actually the number of tables I need to generate late on.(e.g: if random number is:3 we will have tables called T1,T2,T3 or if random number is: 30 we will have T1,T2,...,T30 ).My problem is How can I do this?
1) how can I generate a table when I dont know the actual name of my table?
I dont know if even is this possible?
if it's not do you have any idea how can I generate my tables or any other way I can solve this problem?
This should be possible. A couple of things to keep in mind, though -
1. You need to use a userid to connect to the DB that has appropriate permissions to run DDL commands
2. Introspect on the need to create tables. Can this be avoided?
You will have to generate strings with the names you want and run DDL commands using a prepared statement.