Difference Between ON And WHERE Condition In Join

Usually, while you use joins with ON condition and some time as WHERE condition but what is the exact use of both? There is not any difference between ON and WHERE in INNER JOIN so you can see the actual difference in LEFT JOIN or RIGHT JOIN. To know the difference between ON and WHERE I tried with some simple examples.…

Continue Reading

DateTime conversion and Snippets in MSSQL

Below you can find snippets for SQL to get data for different parts of date and time and all below queries tested in MS SQL server. DateTime Conversions MSSQL string to datetime conversion DateTime Snippets Year First day of this year First day of previous year Last day of previous year Last day of this year First day of next…

Continue Reading

Use CLR functions in SQL

In SQL database you can create functions and stored procedures for calculating data and return some values but as the limitation of SQL as it is not full programming language so sometimes you can not do your stuff with SQL only sometimes you have to go to CLR function to transform some data or calculate some values. CLR functions also…

Continue Reading

Get Recently Run Queries in MSSql Database

Generally when you have multiple users use one database and you have to verify some stored procedures or queries that have been run during some interval in such case you can easily run below query to find all queries so here is how to get recently run queries in MySQL database? : By running this query you can easily track…

Continue Reading

Drop and recreate all indexes in database

SQL Server Management Studio does not have an easy way via the wizard to complete these tasks at the same time. In this tip, we look at a creating a script to drop and create all SQL Server indexes for a SQL Server database. Some cases we found indexes, not in a source control system, dropped or corrupted, indexes need…

Continue Reading

Split Comma Separated List Without Using a Function

There is lots way to get the table from comma separate data by using the function to return table but I found the other way using XML path and using this you get better performance than another way while there are lots of data in a table. Even you get more time using function while to join with other tables…

Continue Reading

Generate CSV (Comma Saparated Values) from table columns

The best way to get CSV data from table by using xml path and it is the best solution for performance and easy way. For example as below: Table: Employee Column: EmployeeType Data EmployeeType ——————– HR Clerk Developers QA Option 1: You can use xml to create CSV as below: Option 2: You can use COALESCE function as below: Option…

Continue Reading