Search
 
SCRIPT & CODE EXAMPLE
 

SQL

query to get all primary keys and foreign key

SELECT OBJECT_NAME(OBJECT_ID) AS NameofConstraint,
SCHEMA_NAME(schema_id) AS SchemaName,
OBJECT_NAME(parent_object_id) AS TableName,
type_desc AS ConstraintType
FROM sys.objects 
WHERE type_desc IN ('FOREIGN_KEY_CONSTRAINT','PRIMARY_KEY_CONSTRAINT')
GO
Comment

PREVIOUS NEXT
Code Example
Sql :: SQL Comments Within Statements 
Sql :: into in sql 
Sql :: oracle job schedules 
Sql :: select only columns that are not empty oracle sql 
Sql :: how to increase the width of the screen in oracle 
Sql :: find in set in postgresql 
Sql :: mysql multiple left joins on same table 
Sql :: mysql select first 10 entries 
Sql :: set value to null postgres 
Sql :: create and attach user to a postgresql database 
Sql :: sqlite get columns for table 
Sql :: get last inserted primary key 
Sql :: show create table in postgresql 
Sql :: sql timezone 
Sql :: how to modify alter user root@localhost identified with mysql_native_password by properly 
Sql :: sql ignore 
Sql :: sql server download for windows 10 64 bit 
Sql :: sql update subtract value 
Sql :: sql constraints 
Sql :: google sheets data validation custom formula filter 
Sql :: on update cascade 
Sql :: sql server port 1434 
Sql :: enable mysql query log 
Sql :: mysql login 
Sql :: sql select condition with left join 
Sql :: online compiler for sql plus 
Sql :: order child below the parent in mysqli 
Sql :: mariadb maximum left join 
Sql :: oracle execute immediate quotes 
Sql :: db2 foreign keys 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =