473,412 Members | 2,262 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,412 software developers and data experts.

How to get the second table from sp_help result?

I am using SQL Server 2000 and I want to be able to list out all the field
names and their datatypes from a particular table.

I found out that sp_help does that but unfortunately when using a recordset,
I could only get the first of the 3 tables.

Is there anyway to get the second table using a recordset because that is
the one with all the info about the fields and their datatypes?

Or is there another way of finding out the datatypes of the fields?
Jul 19 '05 #1
4 2518
You move to the next 'Table' by using the "NextRecordset" method.

--
Al Reid

"It ain't what you don't know that gets you into trouble. It's what you know
for sure that just ain't so." --- Mark Twain

"Gervin" <ge****@pd.jaring.nospam.my> wrote in message news:bv**********@news4.jaring.my...
I am using SQL Server 2000 and I want to be able to list out all the field
names and their datatypes from a particular table.

I found out that sp_help does that but unfortunately when using a recordset,
I could only get the first of the 3 tables.

Is there anyway to get the second table using a recordset because that is
the one with all the info about the fields and their datatypes?

Or is there another way of finding out the datatypes of the fields?

Jul 19 '05 #2
set rs = conn.execute("EXEC sp_help 'tablename'")

do while not rs.eof
response.write rs(0) & "<br>"
rs.movenext
loop

set rs = rs.nextRecordSet()
do while not rs.eof
response.write rs(0) & "<br>"
rs.movenext
loop

set rs = rs.nextRecordSet()
do while not rs.eof
response.write rs(0) & "<br>"
rs.movenext
loop
Also see the first example in http://www.aspfaq.com/2177 for a more concise
and exhaustive output, that doesn't require multiple resultsets.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Gervin" <ge****@pd.jaring.nospam.my> wrote in message
news:bv**********@news4.jaring.my...
I am using SQL Server 2000 and I want to be able to list out all the field
names and their datatypes from a particular table.

I found out that sp_help does that but unfortunately when using a recordset, I could only get the first of the 3 tables.

Is there anyway to get the second table using a recordset because that is
the one with all the info about the fields and their datatypes?

Or is there another way of finding out the datatypes of the fields?

Jul 19 '05 #3
Thanks. I'll give it a try.

"Al Reid" <ar*****@reidDASHhome.com> wrote in message
news:%2*****************@TK2MSFTNGP12.phx.gbl...
You move to the next 'Table' by using the "NextRecordset" method.

--
Al Reid

"It ain't what you don't know that gets you into trouble. It's what you know for sure that just ain't so." --- Mark Twain

"Gervin" <ge****@pd.jaring.nospam.my> wrote in message

news:bv**********@news4.jaring.my...
I am using SQL Server 2000 and I want to be able to list out all the field names and their datatypes from a particular table.

I found out that sp_help does that but unfortunately when using a recordset, I could only get the first of the 3 tables.

Is there anyway to get the second table using a recordset because that is the one with all the info about the fields and their datatypes?

Or is there another way of finding out the datatypes of the fields?


Jul 19 '05 #4
Thanks. I'll give it a try.

Jul 19 '05 #5

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

Similar topics

1
by: Stephen Miller | last post by:
Is it possible to ALTER a temporary table in TSQL (SQL2000)? The following TSQL reports a syntax error at the ALTER TABLE line: DECLARE @Test TABLE( NOT NULL , NOT NULL ) ALTER TABLE...
5
by: ScottyBaby | last post by:
Hi, I've run into a curious problem with MS SQL Server 8.0. Using sp_help and SQL Query Analyzer's object browser to view the columns returned by a view, I find that sp_help is reporting stale...
4
by: serge | last post by:
I ran into a table that is used a lot. Well less than 100,000 records. Maybe not a lot of records but i believe this table is used often. The table has 26 fields, 9 indexes but no Primary Key at...
5
by: MF | last post by:
Newby question but can't find it myself. How can I get a file-description from a file / table ? eg. the decription must deliver the following info: Record nr. Field nr. Fieldname Field...
4
by: Matik | last post by:
Hi, I have a small theoretical issue. I have one table, which is prettyu large. There is lot of evaluations running on this table, that's why, each process need to wait for another to be...
13
by: N. Graves | last post by:
Thanks for taking time to read my questions. I'm looking for a way in Access that I could run a query that would return table schema information. Specifically I need to get the column name,...
2
by: RamaKrishna Narla | last post by:
In MS SQL Server, I have the following tables with some data in it. create table table1 ( column1 varchar(32), column2 int not null, column10 varchar(255), ..... primary key (column1,...
5
by: JSParker1 | last post by:
Summary: Maximum number of records per second that can be inserted into SQLServer 2000. I am trying to insert hundreds (preferably even thousands) of records per second in to SQLServer table...
3
by: visu | last post by:
Hi , can anyone tell me how to get the complete table schema including constraints, primary key ..etc. through sql Query in Ms access. We can get table information in MS SQL Server by means...
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: 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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.