SQL Server access Previous / Next rows and first / last row from partitioned resultset

From SQL Server 2012, new built-in analytic functions are introduced, using that we can easily access subsequent/previous row in the same result set without the use of a self-join and first/last value in an ordered set of values.

In this post, let us see some examples for LEAD(), LAG(), FIRST_VALUE() and LAST_VALUE()

SQL Server - Example for invoking sql file through SQLCMD

SQLCMD utility lets us execute Transact-SQL statements, Stored procedures, and other script files at the command prompt,
in SSMS Query Editor in SQLCMD mode,
in a Windows script file or
in an operating system (Cmd.exe) job step of a SQL Server Agent job.

In this post, let us see an example for invoking sql file through SQLCMD

SSRS Exporting reports to different file formats

Till SQL Server 2012 below are the supported file formats for exporting SSRS reports :

From 2016,