Results 1 to 3 of 3

Thread: List of Database in SQL Server

  1. #1
    Join Date
    Aug 2007
    Posts
    275
    Thanks
    28
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default List of Database in SQL Server

    I am trying to list all Database in an SQL Server. Can someone give me a hint of how should i do this. using QODBC mode in QSqlDatabase?

    I am very new to database stuff so please be gentle if my question is really dumb..

    baray98

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: List of Database in SQL Server

    Quote Originally Posted by baray98 View Post
    I am trying to list all Database in an SQL Server. Can someone give me a hint of how should i do this. using QODBC mode in QSqlDatabase?

    I am very new to database stuff so please be gentle if my question is really dumb..
    If you already suspect, that that question isn't so hard to answer, you might want to use the Newbie section. Further what is the connection to Qt? It's pure SQL related and a simple internet search would have surely lead you to the answer:
    sql Code:
    1. SHOW DATABASES
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jul 2006
    Location
    Catalunya - Spain
    Posts
    117
    Thanks
    16
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: List of Database in SQL Server

    Another answer could be this one ( I'm using SQL Server 2000 and SHOW DATABASES doesn't work for me )

    I use a select like this :

    Qt Code:
    1. SELECT NAME
    2. FROM master..sysdatabases
    3. WHERE ( status & 512 = 0 )
    To copy to clipboard, switch view to plain text mode 

    NOTE : status 512 means "connected". You can have a lot of databases, but some of them could be disconnected...

Similar Threads

  1. Trying to Connect To SQL Server 2005
    By rossd in forum Installation and Deployment
    Replies: 0
    Last Post: 6th March 2009, 19:56
  2. Some Problem with Qt4 link to sql server 2000 Database
    By bangqianchen in forum Qt Programming
    Replies: 0
    Last Post: 29th August 2008, 11:43
  3. Poor performance with Qt 4.3 and Microsoft SQL Server
    By Korgen in forum Qt Programming
    Replies: 2
    Last Post: 23rd November 2007, 10:28
  4. Replies: 1
    Last Post: 4th October 2006, 16:05
  5. Sql Server cannot retrieve data from select
    By Atomino in forum Qt Programming
    Replies: 10
    Last Post: 7th September 2006, 16:37

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.