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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Database logged in on

Status
Not open for further replies.

mart10

MIS
Nov 2, 2007
394
GB
I want to show on a report which database i am logged in ON rather than the database my crsytal was designed and connected TO

I did do a formula in SQL but that just picks up the design connection of the crsystal rather than showing which of 4 potential databases i maybe looged into (which all pickup the same crystal report)

Hope this make sense i am using CR16
 
I can think of a couple of possible ways to do this:

1. Have an extra table in the database that has the database name in it - it would have one column and one row. Include that table in the report (or in a subreport).

2. Depending on what type of database you're using, there may be a system function that will give you this information. If you're just linking tables together, you could then use a SQL Expression to call that function. If you're using a command, you would just add that as a column in your query.

MS SQL Server: "DB_NAME"
Oracle: "ora_database_name"
MySQL: "database()"

For other databases, google <database type> get current database name.

-Dell

Senior Manager, Data & Analytics
Protiviti
 
Thanks but its a vendor SQL application so I cant add tables. You would think from the splash screen login where you select which db to login you could pick that up but the vendor is not being helpful at all
 
If you know what the back-end database is for the application, you might still be able to use the second option that I described. Unfortunately, there is no way to do this natively in Crystal.

-Dell

Senior Manager, Data & Analytics
Protiviti
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top