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

Printing name of datasource

Status
Not open for further replies.

MO22

Technical User
Apr 20, 2001
43
CA
I use the same report template, but switch datasource locations on the fly. Is there any way to print the current datasource location in my report header?
 
Possibly, post your software version adn the possible database types.

In general Crystal doesn't do a great job of this, it requires a SQL Expression.

-k
 
I'm using Crystal Reports XI, reporting from Oracle databases.
 
Try a SQL Expression of:

SELECT name FROM v$database

Probably best to be done in a sunreport in the report header so you only fire the sql once.

-k
 
Dear MO22,

The following SQL Expressions all return information use sys_context or UserENV.

This one returns the database name:

(sys_context ( 'USERENV', 'DB_NAME', 30 ))

This returns the Host Name:

(sys_context ( 'USERENV', 'HOST', 54 ))

This returns the machine name the session was initiated from:

(USERenv('TERMINAL'))

Introduced in Oracle 8i it is supported in later versions, however there may be syntax changes.

There is much more information that can be gleaned like IP address and such.

Look at this link for some examples in Oracle 9:


regards,

ro


Rosemary Lieberman
rosemary-at-microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.

You will get answers more quickly if you read this before posting: faq149-3762
 
Thanks! That did the trick!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top