Results 1 to 3 of 3

Thread: return dartabase name

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2006
    Location
    Jerusalem
    Posts
    39

    return dartabase name

    hi

    im trying to find a function that returns the name of the database im using ..

    for example, im using northwind in sql server. i want to return northwind, dbo and all databases on my local server (their names). shall i make several connections or just connecting to one is enough ! hope thats clear enough .. thnx much.

  2. #2
    Frenzied Member DeadEyes's Avatar
    Join Date
    Jul 2002
    Posts
    1,196

    Re: return dartabase name

    I don't have access to SQL Server at the moment but try
    Code:
    select name from sys.databases
    that maybe version specific, there are usually views which do the same thing but are garunteed to be version independent.

  3. #3
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: return dartabase name

    If you have access to Master Database then you can use this query
    PHP Code:
    Select NAME From master..sysdatabases 
    Use [code] source code here[/code] tags when you post source code.

    My Articles

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width