I have a database called test containing a table called Categories. I want to find the primary key column name in this table.
I wrote this SQL query:
Select COLUMN_NAME
From INFORMATION_SCHEMA.KEY_COLUMN_USAGE
Where OBJECTPROPERTY(OBJECT_ID(CONSTRAINT_SCHEMA+'.'+CONSTRAINT_NAME),
'IsPrimaryKey') = 1 AND TABLE_NAME = 'Categories'
SQL Error:
Error: ERROR 1305 (42000): FUNCTION test.OBJECTPROPERTY does not exist
How can I solve this problem?