TSQL Business Days
Exclude weekends. Account for holidays.
TSQL Encrypt By Pass Phrase
Encrypt data with a passphrase using the TRIPLE DES algorithm with a 128 key bit length. Sources: https://docs.microsoft.com/en-us/sql/t-sql/functions/encryptbypassphrase-transact-sql?view=sql-server-2017
TSQL Date Format
Letter Note yyyy 4 Digit Year MM 2 Digit Month dd 2 Digit Day HH 2 Digit Hour (24 hour format) mm 2 Digit Minute Sources: https://www.mssqltips.com/sqlservertip/2655/format-sql-server-dates-with-format-function/
Set IDENTITY_INSERT On and Off
Cannot insert explicit value for identity column in table ‘sometableWithIdentity’ when IDENTITY_INSERT is set to OFF
Sql Grant Permission
Grants permissions on a table, view, table-valued function, stored procedure, extended stored procedure, scalar function, aggregate function, service queue, or synonym. Syntax Object permission Implied by object permission Implied by schema permission ALTER CONTROL ALTER CONTROL CONTROL CONTROL DELETE CONTROL DELETE EXECUTE CONTROL EXECUTE INSERT CONTROL INSERT RECEIVE CONTROL CONTROL REFERENCES CONTROL REFERENCES SELECT RECEIVE... » read more
Using ROW_NUMBER()
Numbers the output of a result set. More specifically, returns the sequential number of a row within a partition of a result set, starting at 1 for the first row in each partition. ROW_NUMBERĀ is a temporary value calculated when the query is run. There is no guarantee that the rows returned by a query using ROW_NUMBER() will... » read more
Disable All Jobs Script
Generate a script to disable all active jobs on server. Returns all jobs that are not idle or suspended.
Copy Table Using TSQL
Copy table with all rows without creating the table first. Note: Does not copy over constraints.