Langsung ke konten utama

Find Qery SQL

test from pastebin


--All stored procedure and function
SELECT DISTINCT o.NAME AS Object_Name
,o.type_desc
,left(m.DEFINITION, 500) AS def
FROM sys.sql_modules m
INNER JOIN sys.objects o ON m.object_id = o.object_id
WHERE m.DEFINITION LIKE '%GETDATE%' ESCAPE '\'

--Default value on tables
SELECT table_schema
,table_name
,COLUMN_NAME
,column_default
FROM INFORMATION_SCHEMA.COLUMNS
WHERE column_default LIKE '%GETDATE%' ESCAPE '\'
ORDER BY table_schema
,table_name

--Computed column formula on tables
SELECT a.DEFINITION
,a.NAME
,b.NAME
FROM sys.computed_columns a
INNER JOIN sys.tables b ON a.object_id = b.object_id
WHERE DEFINITION LIKE '%GETDATE%' ESCAPE '\'

Komentar

Postingan populer dari blog ini

sys.processes Status sp_who2 SQL Server

Taken from the books online reference for sys.processes  and the status column. dormant = SQL Server is resetting the session. running = The session is running one or more batches. When Multiple Active Result Sets (MARS) is enabled, a session can run multiple batches. For more information, see Using Multiple Active Result Sets (MARS). background = The session is running a background task, such as deadlock detection. rollback = The session has a transaction rollback in process. pending = The session is waiting for a worker thread to become available. runnable = The task in the session is in the runnable queue of a scheduler while waiting to get a time quantum. spinloop = The task in the session is waiting for a spinlock to become free. suspended = The session is waiting for an event, such as I/O, to complete.