Thursday, November 4, 2021

Shortcut of SQL Database Tables

 


--Search with Table Name

SELECT * FROM INFORMATION_SCHEMA.TABLES

WHERE LOWER(TABLE_NAME) LIKE '%' + LOWER('prod%note') + '%'


--Search with Column Name

SELECT * FROM INFORMATION_SCHEMA.COLUMNS

WHERE LOWER(COLUMN_NAME) LIKE '%' + LOWER('prod%note') + '%'


--Search with Table and Column Name

SELECT * FROM INFORMATION_SCHEMA.COLUMNS

WHERE

LOWER(TABLE_NAME) LIKE '%' + LOWER('SalesOrder') + '%'

AND

LOWER(COLUMN_NAME) LIKE '%' + LOWER('Project') + '%'


--Search with Constraint

SELECT

   OBJECT_NAME(o.parent_object_id)

FROM

   sys.objects o

WHERE

   o.name = 'MyConstraintName' AND o.parent_object_id <> 0


No comments:

Post a Comment

Screen Record

 Windows Screen Record WindowsKey+ Alt + R Recording Starts.