0% found this document useful (0 votes)
6 views2 pages

SQL Queries for Database Objects

The document provides a series of SQL query examples for interacting with a database named 'sample'. It includes queries to select object IDs, join tables, and configure database settings. Each example demonstrates different SQL functionalities related to database objects and columns.

Uploaded by

riyasathsafran
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

SQL Queries for Database Objects

The document provides a series of SQL query examples for interacting with a database named 'sample'. It includes queries to select object IDs, join tables, and configure database settings. Each example demonstrates different SQL functionalities related to database objects and columns.

Uploaded by

riyasathsafran
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Example 9.

1
USE sample;
SELECT object_id, principal_id, type
FROM [Link]
WHERE name = 'employee';

Example 9.2
USE sample;
SELECT [Link]
FROM [Link] INNER JOIN [Link]
ON [Link].object_id = [Link].object_id
WHERE [Link] = 'U'
AND [Link] = 'project_no';

Example 9.3
SELECT sys.database_principals.name
FROM sys.database_principals INNER JOIN [Link]
ON sys.database_principals.principal_id = [Link].schema_id
WHERE [Link] = 'employee'
AND [Link] = 'U';

Example 9.4
USE sample;
SELECT t.table_name
FROM information_schema.tables t INNER JOIN
information_schema.columns c
ON t.table_name = c.table_name
AND c.column_name = 'project_no';

Example 9.5
USE sample;
EXEC sp_configure 'show advanced options' , 1;
RECONFIGURE WITH OVERRIDE;
EXEC sp_configure 'fill factor', 100;
RECONFIGURE WITH OVERRIDE;

Example 9.6
USE sample;
SELECT object_id
FROM [Link]
WHERE name = 'employee';
SELECT object_id('employee');

You might also like