How can I use a single mssql connection pool across several routes in an Express 4 web application?

It’s been 3 years since I asked and answered the question. Since then a few things have changed. Here’s the new solution based on ES6, mssql 4 and Express 4 that I would suggest today. Two key elements are at play here. Modules are cached after the first time they are loaded. This means that … Read more

How to disable Constraints for all the tables and enable it?

EXEC sp_MSforeachtable @command1=”ALTER TABLE ? NOCHECK CONSTRAINT ALL” GO You may also want to do this: EXEC sp_MSforeachtable @command1=”ALTER TABLE ? DISABLE TRIGGER ALL” GO To enable them afterwards EXEC sp_MSforeachtable @command1=”ALTER TABLE ? ENABLE TRIGGER ALL” GO — SQL enable all constraints – enable all constraints sql server — sp_MSforeachtable is an undocumented system … Read more

What is the difference between square brackets and single quotes for aliasing in SQL Server?

To answer the question “is there any preference/difference”: Yes, there are as many preferences as there are opinions, but be careful whose preferences you adopt. As a best practice, it is advisable to write portable SQL if it doesn’t require any extra effort. For your specific sample, it is just as easy to write a … Read more