Langsung ke konten utama

Search GETDATE() Function in Sql Server

Search GETDATE in All stored procedure and function

[sql]
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 '\'
[/sql]


Search GETDATE in Default value on tables

[sql]
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
[/sql]

Search GETDATE in Computed column formula on tables

[sql]
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 '\'
[/sql]

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.