SELECT    case isNullable when 1 then 0 else 1 end as required,
st.name as type,
sc.name,
sc.length
    FROM      SysObjects so
    JOIN       SysColumns sc ON so.id = sc.id
JOIN sysTypes st ON sc.xtype = st.xtype
    WHERE    so.name = '#table_nm#'
          AND sc.autoval is not null
   
--
Marlon Moyer, Sr. Internet Developer
American Contractors Insurance Group
phone: 972.687.9445
fax: 972.687.0607
mailto:[EMAIL PROTECTED]
www.acig.com

> -----Original Message-----
> From: Mark W. Breneman [mailto:[EMAIL PROTECTED]
> Sent: Thursday, April 22, 2004 1:37 PM
> To: CF-Talk
> Subject: Query to find Primary key?
>
> Is it possible to find the column name of the primary key in a table
from
> a
> query?
>
>
>
> Select getPrimarykey() as Pkey
>
> From table
>
>
>
> FYI I'm running MS SQL2000
>
>
>
> Thanks
>
>
>
>
>
>
>
> Mark W. Breneman
> -Cold Fusion Developer
> -Network Administrator
>   Vivid Media
>   [EMAIL PROTECTED]
>   www.vividmedia.com
>   608.270.9770
>
>
>
>
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to