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!

How to display the database name in a report.

Status
Not open for further replies.

JustineB

Programmer
Mar 30, 2001
165
GB
I need to display the database name on a report. This is not a field in the "Special Fields" and I was wondering whether anyone has acheived this.
I am using 8.5 connecting via ODBC to a SQL Server Database (this will also be needed for Oracle and Sybase)
I am under the impression that it is impossible, but if anyone has written a UFL for this, please can I "borrow" your code?
Many thanks in advance.

Justine
 
Are you launching the report from an app?
If so you could pass it from your login command to a formula or parameter on the report.

I don't know of another way. Ken Hamady, On-site/Phone Crystal Reports Training/Consulting
Quick Reference Guide to using Crystal in VB
 
This command gets you the name of the current db in SQL Server V7:

select db_name() from master.dbo.sysdatabases where name = db_name()

I'm pretty sure that there is a similar command for Oracle and Sybase. Brian J. Alves
Email: brian.alves@worldnet.att.net
VB / ASP / Crystal / SQLServer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top