Do not use static_cast when you cast from a basic class to a derived one. This may lead to undefined behavior. To handle the polymorphism, a virtual inheritance or a multiple inheritance case always use dynamic_cast instead.
The following short example shows the undefined behavior cases. This works with GCC, VC and online C++ shells:
Local temporary tables are isolated in the scope of current session regardless its name. It means that #temp_table in the session 1 is not the same that #temp_table in the session 2. However, the names of constraints are stored in the metadata of tempdb and can produce duplicate name errors.
Collection of methods to generate random string in a single SQL statement
M1: Recursive string concatenation
On SQL Server the method is limited by 100 characters because of CTE recursion level limitation. The method has the performance issues when using in loops/joins because the table always have 100 rows generated every time.