List Of Attached Databases
Feb 7, 2006How can I, programatically, get a list of attached databases? I'm using VB.
View 4 RepliesHow can I, programatically, get a list of attached databases? I'm using VB.
View 4 RepliesIs there a stored procedure to list attached databases?
You can do this:
use Master
exec sp_helpfile
go
Which shows you the config files for the current DB.
What if you want to do a multiple sp_detach_db? If you could get a list of the attached DB's you could recursilvely or conditioinaly detach.
I need to get records from multiple databases.
In my main database, I have a list of databases related to seperate business units.
For each of those databases, I need to get a list of values from a table (the table exists in each database).
Basically
foreach database in a list
Do a Lookup
end
Possible?
hello anybody now
i need to find how many Databases in my local SQL server (programatically).i know i have 8 databases is there but i need to print each and every database.
can anybody help me.
thanx
kiran.
anyone know how to query a list of databases?
current the sp_helpdb seems cant help me, because it query all the details, i want to do it like select * from database where database id=2
I want to list my databases, and physical related files, and their size but the following commands do not provide the size. Any idea?
SELECT * FROM sysdatabases
SELECT * FROM sys.sysfiles
I know it's silly question
Canada DBA
Is there a way I can query the database server (SQL 2000) to get a list of all the available databases? As a threshold problem I am not clear how I would connect to the server. I am using VB.Net and presently connect to one database at a time. The connection string is in an XML file, such as:
<?xml version="1.0" encoding="utf-8" ?>
<Connection>workstation id=ASUS;packet size=4096;user id=sa;data source="5.15.183.222KWMSDE2"; persist security info=True;initial catalog=tsLocal;password=pass
</Connection>
Is there some special way that you connect to the server without specifying the database?
Is there a certain query I must use once I am connected? Can the information be returned in the form of a data table in a data set?
Thanks.
Hi,
Is there a query I can run to retrieve a list of all tables and their sizes in a database? I want something that is like the feature in Enterprise Manager when you click on a database and then the 'Tables & Index' link. It lists the tables and their respective size. I want to push this into a spread sheet.
The reason why I am doing this is the compare data between 2 different databases. Since I cannot find a tool that will compare the data, the closest I can get (without bcp-ing out all data and comparing) is to look at the sizes of each table.
Thanks!
Joyce
Hi,
I would like to allow the user of my ADO.NET application to browse through a list of the available databases on a given server. INFORMATION_SCHEMA in SQL Server Books Online doesn't describe how to do this. How can I do this?
TIA,
Royce
Any way to list all databases that a user has access to?
View 6 Replies View RelatedIs there a way of limiting the "Databases list" to just the databases which I have permission to?
My databases is in a hosted environment, and the list of databases on that server is HUGE.
Hi all,I have to write a program to read the names of databases in AnalysisServices. I don't know which table I can get this information from.Thanks a bunch
View 2 Replies View RelatedI have MSDE running on my system and I want to get a list of databasesfor that server programmatically. I'm using vb.net and I want to view,add, delete and modify databases on a server from within a class.I'm aware I can use the "Server Explorer" feature in Visual Studio, butthat isn't what I'm looking for. Any references or suggestions on whereto start are appreciated.TIARalf
View 7 Replies View RelatedHey guys,Couldn't find this anywhere in google.I want a list of all database column names for a specific table/viewfrom across database.I tried this...-----------------------------------------------------Select *[color=blue]>From Information_Schema.Columns[/color]-----------------------------------------------------I also tried this...-----------------------------------------------------select syscolumns.name, sysobjects.name, * from syscolumns, sysobjectswheresysobjects.id = syscolumns.idand (sysobjects.xtype='U' or sysobjects.xtype='S')-----------------------------------------------------These queries return information about the CURRENT database.But, if I want to do it ACROSS database or across servers.. how can Ido this?I will express my gratitude to everyone who is kind enough to answerthis question. (I've been stuck with this problem for a while now.)Thanks!OhMyGaw!
View 6 Replies View Related
Is it possible to get an aggregate list of databases from multiple servers, without using SMO?
All target servers are running SQL Server 2005.
Ben Aminnia
Hi everyone,
I have an instance with many databases in it. I am looking for the easiest way to see which of those databases a user has a login on. What is the most efficient way of doing this?
Thanks,
Anil
hi
i have a project and i want make thats;
1-)The list All SQL Server(s) in my network to dropdrown list(that's ok)
2-) the list all databases to selected sqlserver(that's ok)
3-) the list tables to selected database(i cant)
i wrote my source kod please help me
1-)
Dim mDMOApp As New SQLDMO.Application
Dim mNames As SQLDMO.NameList
Dim t As Integer
mDMOApp = New SQLDMO.Application
mNames = mDMOApp.ListAvailableSQLServers()
lstServers.Items.Clear()
For t = 1 To mNames.Count
lstServers.Items.Add(mNames.Item(t))
Next
2-)
Dim server As New SQLDMO.SQLServer
Dim db As SQLDMO.Database
server.Connect(mysqlserver, "xxx", "xxx")
For Each db In server.Databases
lst.Items.Add(db.Name)
Next
3)
how can i ???
Hi All,
The web site I'm working on will allow admin users to create a new database for each new client. I'm hoping to be able to keep all of the databases in the local App_Data folder, but I'm finding that I can't even find a way of generating a list of the databases in the App_Data folder.
The code I have is:Dim serverConn As New ServerConnection(".SQLEXPRESS")
serverConn.LoginSecure = True
serverConn.ConnectTimeout = 30
serverConn.Connect()
Dim sqlServer As Server = New Server(serverConn)
For Each db As Database In sqlServer.Databases
ListView1.Items.Add(db.Name)
NextThis does populate a list of databases, but not the ones in the App_Data folder - just those attached directly to the server.Any help on this will be greatly appreciated as it's starting to drive me nuts!Thanks,Paul
I want to get the names of the databases of the server using OleDbConnection in c# which i have to add in to a combobox.....the same task i achieved using SqlConnection where in there is a Class SqlClientCollectionNames...the code is as followsusing (SqlConnection connection =new SqlConnection("Data Source=server;User ID=username;Password=passwd")) { connection.Open(); DataTable myData = connection.GetSchema(SqlClientMetaDataCollectionNames.Databases); foreach (DataRow row in myData.Rows) comboBox1.Items.Add(row[0]); connection.Close();} but the same i did for OleDbConnection it is not working using (OleDbConnection connection =new OleDbConnection("Provider=SQLOLEDB;Data Source=server;User ID=username;Password=passwd"))
{
connection.Open();
DataTable myData = connection.GetSchema(SqlClientMetaDataCollectionNames.Databases);//no such method Databases present in OleDb namespace
foreach (DataRow row in myData.Rows)
comboBox1.Items.Add(row[0]);
connection.Close();
} is there any other way to do this using OleDbConnection........??Please help
Hi all,
Now, I using Windows200o & SQL7.0.
I want to permission a client connect to my server,
and with his login, he only works with a specify datatbase.
When he connects to my server, although he can't work other databases,
but he can list of them in server - using EM (and I don't want he knows this).
How can I solve this problem? Thanks.
Hi,
I'm trying to list all database locations with SQL command, but getting lost here :(
So, anyone any idea how to get databasefile locations from server?
All I need is like: 'C:Program FilesMicrosoft SQL ServerMSSQLDatamaster.mdf' and others.
Thanks.
I would like to SELECT all filegroup on an SQL server instance, is that possible?Or only per database?
View 21 Replies View RelatedHi
I have created a new login in SQL Server 2000.
I have hooked up to more than one database which creating the login.
In syslogins we can see only the default database associated with that login.
I want the list of all the databases for that specific login..
How could I get them?
-------------------------------------------------------------------------------
My main task is to create a login under a specific database.
For which I'm validating whether that login already exists or not I'm checking it in the syslogins table. I need to specifically check it is in my databse or not....for that what should I do...
Thanks in advance
I need to generate a list of databases, jobs, DTS packages, Linked servers, and users.
Is there a simple script or procedure for this?
Thanks
I am using SQL Server Express 2008 Management Studio & in the databases list are some databases that are non existent (have been deleted in Windows Explorer). How do I remove them as trying to delete when logging in using Windows authentication fails?
View 16 Replies View RelatedLooking for query that lists all databases, in an instance, that are not accessed before a given date (e.g., not accessed before December 31, 2014)?
View 6 Replies View RelatedHi. I am using VS 2005 and I want to create a database file (mdf) and have it on my server, but not have it attach to an instance of SQL server. Is this possible? The hosting I am using only allows for 1 SQL DB, and obviously doesn't allow you to attach instances of a DB. I would rather go with an mdf file that access, but not sure if this is possible. If anyone knows if it is and how to pull it off it would be GREAT!!
View 7 Replies View Relatedhow can i attached MDF file only without .log and data only
View 6 Replies View RelatedI have two programs which access sql server 2005. One was written in vb6 the other in vb8 (aka vb.net 2005).
vb6 works well with this connection string:
Provider=SQLNCLI;Integrated Security=SSPI;Persist Security Info=False;Database=MyDbName;Data Source=.MyServerInstanceName
vb8 (in vs2005) generated the following connection string which works well in the vb8 application:
Data Source=.MyServerInstanceName;AttachDbFilename='C:MyDbPathMyDbName.mdf';Integrated Security=True
Within their own programs each connection string works well. However, if I use one program and then the other (e.g., vb8 program then vb6), I get an error message:
Unable to open the physical file "C:MyDbPathMyDbName.mdf". Operating system error 32: "32(The process cannot acces the file because it is being used by another process.)".
If I detach the database using SSMS, I can then access it with the other program. Obviously, this is not an ideal situation and not something I would want the end user to have to do.
Also, when using the vb6 connection string, SSMS lists the database in Object Explorer as: MyDbName. When using the vb8, the database is listed as C:MyDbPathMyDbName.mdf. BTW, the database is set for multi-user.
How can I get the two programs to place nice together?
Hi,
I was trying to figure out how to back up a database that has been attached to the SQL Express instance. I found on the web this tutorial and tried to use it, however it seems like it cannot find the database. The DB is attached by the web application using AttachDbFilename in the connectionstring.
http://www.sqldbatips.com/showarticle.asp?ID=27
Any ideas?
thanks
I used Query Analyser to De-tach a SQL 7 database and that worked fine. The database became 'invisible' in Enterprise Manager and the entry was removed from the sysdatabases in Master. The mdf and ldf file remain in the file system. However, when I ran the sp to Attach the database QA said successful but it does not show in Enterprise Manager or in sysdatabases in Master. I'm going to run through the procedure again and if problems I'll check the logs but has anyone else had difficulty with this. Also with attaching the db to a SQL2000 install I believe the logins on the SQL7 install are not brought over. In my case, the client is using trusted logins with their database application so their is probably not a lot to manually recreate on the SQL 2000 install but doees anyone have nay sample code/script that can give me an idea of what is required in the area of getting logins out of the Master of SQL7 and into SQL2000.
Great forum...
Have a great day,
ChrisE
If you re-attach a db to a different server, presumably you are shutting out your users (by them not having logins to the new server). If you are moving to a different domain I can only think that having the sa pwd and switching to "Mixed Authentication" would be the only way to get back in to start adding new logins/users, is that correct?
View 2 Replies View RelatedHello all,
I'm using SQL 2005 Express edition. I'm currently connecting to the database file directrly (from ASP.NET) and that db file is not attached to the server.
My question is this:
What is the difference ? Will the performance improve if the db is attached and I connect to it throught the server ? I'm really not sure what the difference is.
Thanks