For SQL Server, try this:
<cfquery name="q2" datasource="yourDatasource">
SELECT * from INFORMATION_SCHEMA.columns
WHERE table_name = 'yourTable'
ORDER BY column_name
</cfquery>
<cfoutput query="q2">
<tr>
<td> #q2.column_name#</td>
<td> #q2.data_type#</td>
<td>#q2.character_maximum_length#</td>
</tr>
</cfoutput>
----- Original Message -----
From: "Robertson-Ravo, Neil (RX)" <[EMAIL PROTECTED]>
To: "SQL" <[email protected]>
Sent: Tuesday, February 08, 2005 2:30 PM
Subject: RE: returning datatypes from table using CF5
> You will have to use a join on some system tables.
>
> This will do it.
>
> select syscolumns.name,systypes.name,syscolumns.length from sysobjects
> inner join syscolumns on syscolumns.id = sysobjects.id
> inner join systypes on systypes.type = syscolumns.type
> where sysobjects.type = 'U'
> and sysobjects.name ='yourtablename'
>
>
>
>
>
> -----Original Message-----
> From: Cameron Childress
> To: SQL
> Sent: 08/02/2005 16:59
> Subject: Re: returning datatypes from table using CF5
>
> For SQL Server, you're going to want to look into sysobjects. Access
> is similar, but I can't remember exactly the table names. Google for
> "system tables" and you should get what you need.
>
> -Cameron
>
>
> On Mon, 7 Feb 2005 15:28:16 -0800 (PST), William Kossack
> <[EMAIL PROTECTED]> wrote:
>> we are moving to sql server but some databases are
>> still in access
>>
>> --- Cameron Childress <[EMAIL PROTECTED]> wrote:
>>
>> > Depending on the database platform, you should be
>> > able to query the
>> > system tables to get this information. What
>> > platform are you on?
>> >
>> > -Cameron
>> >
>> > On Mon, 07 Feb 2005 16:58:18 -0400, william kossack
>> > <[EMAIL PROTECTED]> wrote:
>> > > I'm using CF5
>> > >
>> > > I need to be able to query a database table and
>> > return the data types.
>> > >
>> > > I'm currently using queryname.columnlist to get a
>> > list of the field names but I can't seem to get the
>> > data types
>> > >
>> > >
>> >
>> >
>>
>>
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49
Message: http://www.houseoffusion.com/lists.cfm/link=i:6:2113
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/6
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:6
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.6
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54