Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
AFIELDS() on cursor from SQL Server
Message
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01463201
Message ID:
01463225
Views:
34
>>>Hi,
>>>
>>>I was wondering if, when getting a cursor from SQL Server into VFP app (via SPT call), it is possible to determine if a field/column has a FOREIGN KEY constraint set? I am looking at the AFIELDS() function which populates 18 elements for each field but I don't seem to see any that would indicate FK constraint. Is it possible?
>>>
>>>TIA.
>>
>>No, it does not. You need to bring this info from the SQL Server in a separate call.
>
>Thank you. How would you call SQL Server to get info on FK constraint?

Take a look at this query
SELECT  C.Table_Name, C.Column_Name
FROM    Information_Schema.Columns C
        INNER Join Information_Schema.Tables T
          ON C.Table_Name = T.Table_Name
          And T.Table_Type = 'Base Table'
        INNER Join Information_Schema.constraint_column_usage U
          ON C.Table_Name = U.Table_Name
          And C.Column_Name = U.Column_Name
          WHERE U.TABLE_NAME = 'dEPARTMENT'
You can get similar info by querying different metadata tables.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform