MSSQL

SQL icon baseThere is an issue with Leap Year and DateAdd function that can appear if you want to compare two dates from different years and using some date value from table. For example if you have calendar table and use DateAdd function, you can get 2 rows wit two date for one source date instead of expected 1 row. See bellow reason and solution.

SQL icon baseWhen you need select Min or Max value from table with one column, it's easy SQL task. A little harder is same request when you want to find minimum value and maximum value associated with column from minimal value row. For example, let's say we want see Customer with his minimum sales order plus amount value of this order and compare it to maximum value from any other order made with this customer.

SQL icon baseThe AdventureWorks databases are sample databases originally published by Microsoft to show how to design a SQL Server database using SQL Server 2008. AdventureWorks is the OLTP sample, and AdventureWorksDW is the data warehouse sample. 

I am using these databases for example in my scripts. Quick download links and instructions can help, if you have not this database on your SQL server yet.

SQL icon baseAre you trying convert float to numeric and you get "Arithmetic overflow error converting float to data type numeric" error? This could happen even if all was working before and now it fails. The reason should be in precision and scales settings.

cofee_book.pngWhen you need script more than one job from Microsoft SQL Server Management Studio by right click with mouse 'Script job', you will find you can script only one object and you cannot choose more than one job at once. Even with Shift or Ctrl key. Script all of then one by one can be really long and unpleasure work. But there is a an easy way, how to script all jobs (or objects like views, tables etc.).

Subcategories