SQL Server 2019 Transact-SQL optimization tips (Part 1) Use table variables instead of temporary tables. Table variables require less locking and logging resources than temporary tables, so table variables should be used whenever possible. Try to avoid using SQL Server cursors, whenever possible. SQL Server cursors can result in some performance degradation in comparison with select statements. Try to use...
Tag: trigger
Some tips for using SQL Server 2019 triggers
Some tips for using SQL Server 2019 triggers Try to minimize the number of rows affected in a trigger. The more number of rows affected in a trigger, the more time a trigger takes to run. So, try to reduce the number of rows affected in a trigger. Consider disabling trigger’s recursion. Triggers are said to be recursive when a...
Troubleshooting problems with SQL Server 2017 triggers
Troubleshooting problems with SQL Server 2017 triggers If you have problems with SQL Server 2017 triggers, review this troubleshooting checklist to find potential solutions. 1. Access violation occurs when a DDL trigger is raised by the CREATE EXTERNAL TABLE command. Additionally, you may receive the following error messages: “Cannot continue the execution because the session is in the kill state.”...
Tips for designing SQL Server 2017 tables (Part 2)
Tips for designing SQL Server 2017 tables (Part 2) Use varchar/nvarchar columns instead of text/ntext columns whenever possible. Because SQL Server 2017 stores text/ntext columns on the Text/Image pages separately from the other data, stored on the Data pages, it can take more time to get the text/ntext values. If you need to store integer data from -32,768 through 32,767,...
Tips for using constraints in SQL Server 2017
Tips for using constraints in SQL Server 2017 Use cascading referential integrity constraints instead of triggers whenever possible. For example, if you need to make cascading deletes or updates, specify the ON DELETE or ON UPDATE clause in the REFERENCES clause of the CREATE TABLE or ALTER TABLE statement. The cascading referential integrity constraints are much more efficient than triggers...
Troubleshooting problems with SQL Server 2016 triggers
Troubleshooting problems with SQL Server 2016 triggers If you have problems with SQL Server 2016 triggers, review this troubleshooting checklist to find potential solutions. 1. Install the latest SQL Server 2016 service pack. Because many SQL Server 2016 triggers bugs were fixed in SQL Server service packs, you should install the latest SQL Server service pack. At the time this...
Some tips for designing SQL Server 2016 tables (Part 1)
Some tips for designing SQL Server 2016 tables (Part 1) Avoid using timestamp column as a primary key. Timestamp is a data type that exposes automatically generated, unique binary numbers within a database. Every time that a row with a timestamp column is modified or inserted, the incremented database rowversion value is inserted in the timestamp column. This property makes...
Troubleshooting problems with SQL Server 2014 Triggers
Troubleshooting problems with SQL Server 2014 Triggers If you have problems with SQL Server 2014 triggers, review this troubleshooting checklist to find potential solutions. 1. Install the latest SQL Server 2014 service pack. Because many SQL Server 2014 triggers bugs were fixed in SQL Server service packs, you should install the latest SQL Server service pack. At the time this […]
SQL Server 2014 Transact-SQL Optimization Tips (Part 2)
SQL Server 2014 Transact-SQL Optimization Tips (Part 2) Try to restrict the queries result set by using the WHERE clause. This can results in good performance benefits, because SQL Server will return to client only particular rows, not all rows from the table(s). This can reduce network traffic and boost the overall performance of the query. Consider using the CONTAINS...
SQL Server 2014 Transact-SQL Optimization Tips (Part 2)
SQL Server 2014 Transact-SQL Optimization Tips (Part 2) Try to restrict the queries result set by using the WHERE clause. This can results in good performance benefits, because SQL Server will return to client only particular rows, not all rows from the table(s). This can reduce network traffic and boost the overall performance of the query. Consider using the CONTAINS […]