Create Indexes with Included Columns
By including nonkey columns, you can create nonclustered indexes that cover more queries. This is because the nonkey columns have the following benefits: They can be data types not allowed as index key columns. They are not considered by the Database Engine when calculating the number of index key columns or index key size. An... » read more
Index Seek vs Index Scan (Table Scan)
Index Scan retrieves all the rows from the table. Index Seek retrieves selective rows from the table. An scan or table scan is when SQL Server has to scan the data or index pages to find the appropriate records. A seek uses the index to pinpoint the records that are needed to satisfy the query.... » read more
Full Text Index
Full Text Index vs Index Usually, when searching with a normal index, you can search only in a single field, e.g. “find all cities that begin with A” or something like that. Fulltext index allows you to search across multiple columns, e.g. search at once in street, city, province, etc. That might be an advantage... » read more
Database Sequence
You can either use the sequence in the table definition or insert it later when you insert the row. Sequence vs. Identity columns Sequences, different from the identity columns, are not associated with a table. The relationship between the sequence and the table is controlled by applications. In addition, a sequence can be shared across multiple... » read more
Using Powershell to Remove Files via SQL Job
In SQL Job, create the following step Type: PowerShell Run as: SQL Server Agent Service Account Command:
Database Log File Full
Log records that are not managed correctly will eventually fill up the disk causing no more modifications to the database. Transaction log growth can occur for a few different reasons. Long running transactions, incorrect recovery model configuration and lack of log backups can grow the log. Log truncation frees up space in the log file... » read more
##Table Global Table
#temp tables are available ONLY to the session that created it and are dropped when the session is closed. ##temp tables (global) are available to ALL sessions, but are still dropped when the session that created it is closed and all other references to them are closed.
# vs ## Table
#temp tables are available ONLY to the session that created it and are dropped when the session is closed. ##temp tables (global) are available to ALL sessions, but are still dropped when the session that created it is closed and all other references to them are closed. Local temporary tables are visible only in the... » read more
sp_helptext
The sp_helptext is a system stored procedure that is used to view the text definition of any SQL Server objects that contain code. It can be used for unencrypted user-defined stored procedures, functions, views, triggers, even system objects such as system stored procedures. sp_helptext uspMyProcedureName