This post intends to set out how to make recursive SQL queries in a simple and straightforward manner using Common Table Expressions (CTE).
What are CTEs?
As it is said in Microsoft SQL Server documentation a CTE (Common Table Expression) can be thought of as a temporary result set that is defined within the execution scope of a single SELECT, INSERT, UPDATE, DELETE, or CREATE VIEW statement. A CTE is similar to a derived table in that it is not stored as an object and lasts only for the duration of the query. Unlike a derived table, a CTE can be self-referencing (important for the purposes in this post!) and can be referenced multiple times in the same query.
[More]
As I was setting up a demo project on my local computer for dealing with a Multi-Tenancy application, I came across with some problems (like many other times). The issue this time had to do with accessing the same web application using different host names, each one employed for handling a different tenant (client).
So, here are the first steps to configure Hosts file in Windows, Visual Studio Web Applications and IIS and to begin to work properly with this kind of multi-tenant functionality.
[More]
This SQL tip is about generating random int values between upper and lower limits.You can also use the attached content to create a simple template database to make your own demos or tests.
[More]