2010-01-10 91 views

回答

3

使用INFORMATION_SCHEMA的意見:

SELECT 
    T.TABLE_NAME 
FROM 
    INFORMATION_SCHEMA.TABLE_CONSTRAINTS T 
    INNER JOIN 
     INFORMATION_SCHEMA.KEY_COLUMN_USAGE K 
     ON T.CONSTRAINT_NAME = K.CONSTRAINT_NAME 
WHERE 
    T.CONSTRAINT_TYPE = 'PRIMARY KEY' 
    AND K.COLUMN_NAME = @column_name 
相關問題