Script a table from a ODBC database with C#

0 Comments

If you want to create a corresponding SQL Server database table, from a ODBC table, you can use the following C# function: Note This function is not bullet proof, but gives you a simple example:

Get first day of current week or last week with TSQL

0 Comments

To get the first day of the current week use: select dateadd(dd, (datepart(dw, getdate()) * -1) + 2, getdate()) To get the first day of previous week and last day of previous week use: select

Best Practices TSQL

0 Comments

This post will be edited each time I find a best practice for TSQL Never use <,>,<=,=> on datetime, always use datediff