Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Retrieving table info in SQL
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Dnd
Starting Member

USA
1 Posts

Posted - 22 March 2007 :  09:44:28  Show Profile
I'm trying to find a way using a straightforward SQL command (in VBScript to a SQL 2000 db through an ASP application - all legacy stuff) to count the numer of columns (fields) in a table then return the field names. Any suggestions? I've scoured the literature available in McSoft, and the only way that comes close is using a view, which is way too convoluted.

Thanks in advance! Dnd

Podge
Support Moderator

Ireland
3776 Posts

Posted - 22 March 2007 :  09:56:42  Show Profile  Send Podge an ICQ Message  Send Podge a Yahoo! Message
You can SELECT from a view the same way as from a table.

See the Section entitle "The List"
http://www.sqlservercentral.com/columnists/bkelley/informationschemaviews.asp

Podge.

The Hunger Site - Click to donate free food | My Blog | Snitz 3.4.05 AutoInstall (Beta!)

My Mods: CAPTCHA Mod | GateKeeper Mod
Tutorial: Enable subscriptions on your board

Warning: The post above or below may contain nuts.
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 22 March 2007 :  13:42:54  Show Profile
You can use the built-in INFORMATION_SCHEMA view. I don't have the exact syntax, but something like SELECT COLUMN_NAME FROM INFORMATION_SCHEMA WHERE TABLE_NAME = 'myTable'

You can get all the properties of the db structure.

======
Doug G
======
Computer history and help at www.dougscode.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.21 seconds. Powered By: Snitz Forums 2000 Version 3.4.07