Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Table name parameter 2

Status
Not open for further replies.

jascra

Programmer
Jul 9, 2002
19
I would like to use a parameter for the table name. I have a database that creates tables based on a date and location and sets the table name to this. This way, there will be several new table names created every month. The fields are always identical. I therefore need the table name to be sent into CR via a parameter. I do not create the reports with any programming outside of CR. Is there any way to use a parameter for the table name?

Thanks
 
If this is not possible, do you have any suggestions as to how I can accomplish what I want besides myself running this report every month and having to change the table names?

I have not created any stored procedures before, but I am willing to learn. Would it be possible to create a stored procedure that receives the table name as a parameter, and base the CR report on the stored procedure? If so, where would be a good place to start learning about stored procedures?

Thanks
 
Actually, you can do this if you use a command as your datasource. Open a blank report->select "add command" at the top of the table list, and then create a string parameter within the command (on the right). Then set up the command like this:

Select {?table}.`field1`, {?table}.`field2`
from {?table}

Or even more simply (if you are only using one table):

Select `field1`, `field2`
from {?table}

The punctuation depends upon your datasource.

-LB
 
Thank you! Thank you! Thank you! This is exactly what I wanted to do, and it worked. You are a great help.

Laura
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top