Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: field names


Message #1 by "kofi karikari" <kofikarikari@h...> on Tue, 05 Nov 2002 10:22:05 +0000

-----Original Message-----
From: kofi karikari [mailto:kofikarikari@h...]
Sent: 06 November 2002 12:29
To: sql language
Subject: [sql_language] Re: field names



Not sure think its desc <TableName>

Thanks Jeff
This is perfect. Can I do the same for oracle datebase?
Cheers






>From: "Jeff Mason" <je.mason@a...>
>Reply-To: "sql language" <sql_language@p...>
>To: "sql language" <sql_language@p...>
>Subject: [sql_language] Re: field names
>Date: Tue, 5 Nov 2002 11:50:44 -0500
>
>You can use the INFORMATION_SCHEMA.COLUMNS view to retrieve 
information
>about the columns in a selected table, e.g.
>
>	SELECT Column_name FROM Information_Schema.Columns
>	WHERE Table_Catalog=3D'Your_database' AND Table_Name=3D'Your_Table'
>
>will return a resultset of column names.
>
>--
>Jeff Mason              Custom Apps, Inc.
>Jeff@c...
>
>
>-----Original Message-----
>From: kofi karikari [mailto:kofikarikari@h...]
>Sent: Tuesday, November 05, 2002 11:28 AM
>To: sql language
>Subject: [sql_language] Re: field names
>
>
>This works but my concern is if there are millions of records, I will 
have
>to select all and loop through before I can get the field names.
>
>
> >From: "Nicholas Trevatt" <nicholas@t...>
> >Reply-To: "sql language" <sql_language@p...>
> >To: "sql language" <sql_language@p...>
> >Subject: [sql_language] Re: field names
> >Date: Tue, 5 Nov 2002 13:59:54
> >
> >I can see a couple of ways but here is one just using a standard ADO
> >Connection object and ADO Recordset.  Make a connection to the data
> >source, select all fields using a SELECT * and then use the
> >Recordset.Fields(i).Name and loop through them all.  Here is a quick
> >example where I used a DataEnvironment to connect to my local SQL 
Server:
> >
> >     Dim rs As Recordset
> >     Dim strSQL As String
> >     Dim i As Integer
> >
> >     strSQL =3D "SELECT * FROM Contacts"
> >     DataEnvironment1.conStudMan.Open
> >     Set rs =3D DataEnvironment1.conStudMan.Execute(strSQL)
> >     For i =3D 0 To rs.Fields.Count - 1
> >         Debug.Print rs.Fields(i).Name
> >     Next i
> >     DataEnvironment1.conStudMan.Close
> >
> >Hope this helps.
> >Nicholas Trevatt
> >
> >
> >How can I programmatically(using VB) select all the field names from 
sql
> >server table?
> >
> >
> >
> >
> >_________________________________________________________________
> >Protect your PC - get McAfee.com VirusScan Online
> >http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3D3963
> >
>
>
>_________________________________________________________________
>Unlimited Internet access for only $21.95/month.=A0 Try MSN!
>http://resourcecenter.msn.com/access/plans/2monthsfree.asp
>
>
>
>
s

_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*
http://join.msn.com/?page=3Dfeatures/junkmail





NOTICE AND DISCLAIMER:
This email (including attachments) is confidential.  If you have 
received
this email in error please notify the sender immediately and delete 
this
email from your system without copying or disseminating it or placing 
any
reliance upon its contents.  We cannot accept liability for any 
breaches of
confidence arising through use of email.  Any opinions expressed in 
this
email (including attachments) are those of the author and do not 
necessarily
reflect our opinions.  We will not accept responsibility for any 
commitments
made by our employees outside the scope of our business.  We do not 
warrant
the accuracy or completeness of such information.


  Return to Index