473,385 Members | 1,461 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

SQL 2005 - call to get all tables in a DB

JPS
What kind of a query do I use when all I want to do is get a lst of al
of the tables in a database and their fields. I'm trying to get schema
information and GetSchema give you the field type but not the value.
Theis (below) does not work.

sqlCmd.CommandText = "SELECT * FROM INFORMATION_SCHEMA.COLUMNS";
SqlDataReader sqlDr = sqlCmd.ExecuteReader ( );

Jan 9 '07 #1
4 1604
the db is the "master".

so, in your connect string, specify it, or
you can experiment with

"SELECT * FROM master.dbo.INFORMATION_SCHEMA.COLUMNS";

"JPS" <jp*****@yahoo.comwrote in message
news:11**********************@i39g2000hsf.googlegr oups.com...
What kind of a query do I use when all I want to do is get a lst of al
of the tables in a database and their fields. I'm trying to get schema
information and GetSchema give you the field type but not the value.
Theis (below) does not work.

sqlCmd.CommandText = "SELECT * FROM INFORMATION_SCHEMA.COLUMNS";
SqlDataReader sqlDr = sqlCmd.ExecuteReader ( );

Jan 9 '07 #2
Hi,
What you mean with the value?

"JPS" <jp*****@yahoo.comwrote in message
news:11**********************@i39g2000hsf.googlegr oups.com...
What kind of a query do I use when all I want to do is get a lst of al
of the tables in a database and their fields. I'm trying to get schema
information and GetSchema give you the field type but not the value.
Theis (below) does not work.

sqlCmd.CommandText = "SELECT * FROM INFORMATION_SCHEMA.COLUMNS";
SqlDataReader sqlDr = sqlCmd.ExecuteReader ( );

Jan 9 '07 #3
Hi,

"sloan" <sl***@ipass.netwrote in message
news:Ot**************@TK2MSFTNGP03.phx.gbl...
the db is the "master".

so, in your connect string, specify it, or
you can experiment with

"SELECT * FROM master.dbo.INFORMATION_SCHEMA.COLUMNS";

In 2005 at least you have a INFORMATION_SCHEMA.COLUMNS in the DB itself,

And btw you CANNOT prefix it with dbo. INFORMATION_SCHEMA. is the correct
owner.

--
Ignacio Machin
machin AT laceupsolutions com
Jan 9 '07 #4
Ok..yeah, thanks for the correction.

dbo. is a typing habit sometimes.

at least I said "experiment with"...

"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comwrote in
message news:Oi**************@TK2MSFTNGP06.phx.gbl...
Hi,

"sloan" <sl***@ipass.netwrote in message
news:Ot**************@TK2MSFTNGP03.phx.gbl...
the db is the "master".

so, in your connect string, specify it, or
you can experiment with

"SELECT * FROM master.dbo.INFORMATION_SCHEMA.COLUMNS";


In 2005 at least you have a INFORMATION_SCHEMA.COLUMNS in the DB itself,

And btw you CANNOT prefix it with dbo. INFORMATION_SCHEMA. is the
correct
owner.

--
Ignacio Machin
machin AT laceupsolutions com


Jan 9 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: nick | last post by:
I have only SQL Server 2005 installed on my PC. And I tried to add the following rows in web.config to use SQL Server 2005 instead of Express: <connectionStrings> <clear /> <add...
15
by: Scotty | last post by:
I like to have a good insert, update and delete code The code below sometimes workl ok sometimes doesnt work, what i am doing wrong?? Sub SaveAny() Dim command_builder As New...
17
by: boa | last post by:
I'm currently planning disk layouts and use for a new version of our database. The current version has all data and indexes in the default filegroup, placed on one big raid-5 array(6 drives) along...
3
by: Eric J. Holtman | last post by:
Am I missing something obvious in the 2005 Visual Studio portion of SQL Server? I have a database design, with a bunch of tables, views, stored procedures, etc, etc. I want to store each object...
9
by: HC | last post by:
Hello, all, I started out thinking my problems were elsewhere but as I have worked through this I have isolated my problem, currently, as a difference between MSDE and SQL Express 2005 (I'll just...
16
by: Omar Abid | last post by:
Hi every body, Im using VB 2005 to create a program that open SQL Data base The problem that i want to detect the tables of a database so how can i know a data base tables instantly Thank you...
2
by: chaosdl | last post by:
Hello, I am currently using Visual Basic 2005 express edition with a MS Access database. I have made a "Contacts" Form, where the user will be able to enter a members surname and press an OK...
2
by: cj | last post by:
We have a legacy accounting system (not developed in house) here that happens to be written in Visual FoxPro. One of the tables has an index that is actually a coded function COMPANY1 ...
0
Dököll
by: Dököll | last post by:
ASP.NET and SQL Server 2005 Database interaction includes: Language: ASP.NET Connectivity: SQL Server 2005 Foreword: This database connectivity is nothing of genius, it is a simple...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.