In a real world scenario, we can sale in our online store on standard or discounted prices. In this exercise we use three tables to demonstrate the zig-zag JOIN:
SQL Server
I am very happy to announce that my first book, dedicated to Microsoft SQL Server from the Learn Intuitively series is now on KickStarter.
When we write a DML query that is using JOINed tables as data source, first we need to understand the way SQL Server is manipulating the data. The clauses in the DML query statement are ordered as follows: SELECT FROM… JOIN WHERE GROUP BY HAVING ORDER BY Behind the scene […]
When we create dynamic SQL code, we can add the parameters in two ways: Concatenate them into the dynamic code with + Use sp_executesql
In some situations a scheduled shrink of the log files is needed to release disk space. The script bellow can be scheduled in SQL Server Agent Job.
Let’s say that we have a SP with predefined parameters, i.e. @Parameter1 can hold values 1, 2 or 3; @Parameter2 can hold values of A, B, C or D and so on. This script creates all the possible combinations for the parameters of the SP and executes the SP as many times […]
Very often while exchanging data files with clients, a useful information is stored in the file name. This can be a client name prefix, date, time, the period that filtered the data in the file and so on. While loading the data into the database, we need to extract the […]
Very often we make changes to the design of an underlying objects, used by views. After we do this, we need to refresh the views to apply the changes. In this example we will: 1. Create View 2. Change the design of an underlying object 3. Refresh all the views […]
Working with multi-value parameters in SSRS is always fun. We need to pick a good delimiter, add additional values like “ALL” or “BLANKS” and many others. In the following few lines I explain a logics to add a multi-value parameter to SSRS with additional values (all) to not apply the […]
In a lot of situations we may not have permissions to use SQL Server Agent for automations of our back-end processes. I built a run-around that uses a Windows Scheduled Task, SQLCMD and Stored Procedure to run task. Work flow: 1. Windows Scheduled Task calls a .bat file at specific […]