Export data from SQL Server to an Excel file


Sometimes you need to export data from SQL Server tables, views or the result of any T-SQL query into excel file, reason could be anything such as MIS team need Sales data in excel file…

 274 total views,  17 views today

Read More...

SQL Server Date


Date data type allows you to store the date data in the database. It takes 3 bytes to store a date value. SYNTAX date The format of date is YYY-MM-DD, where YYYY is four digits…

 38 total views,  5 views today

Read More...

How to fetch alphanumeric string from table


Assume that you have a table which contains alphabetic, numeric, alphanumeric string, and special characters and you are asked to fetch only alphanumeric string from those strings. Following is the sample table named Numbers which…

 201 total views,  1 views today

Read More...

Difference between clustered index and non clustered index


SQL Server indexes are used by queries to find data values quickly in tables and views. Basically it speed up the queries performance. You can also relate a SQL Server Indexes with any text book…

 572 total views,  6 views today

Read More...

SET STATISTICS IO


SQL STATISTICS IO is a set statement , when it is enabled it causes SQL Server to display information about the amount of disk activity generated by T- SQL statement. SYTANX SET STATISTICS IO {…

 161 total views

Read More...

SQL IS NULL


The IS NULL is used in SQL to find a NULL value. It returns TRUE if a NULL value is found, otherwise it returns FALSE. SYNTAX SELECT col1, col2, .. FROM Table WHERE Expression IS…

 118 total views,  1 views today

Read More...

SQL IS NOT NULL


The IS NOT NULL is used in SQL to find a non-NULL value. It returns TRUE if a non-NULL value is found, otherwise it returns FALSE. SYNTAX SELECT col1, col2, .. FROM Table WHERE Expression…

 162 total views,  2 views today

Read More...

Insert multi language data in table


Sometimes, you need to store multi language or multilingual data in any table column. Inserting a multilingual data into column without following some basics rules, you see that when you select data from table, it…

 383 total views,  2 views today

Read More...

SQL Random Number


SQL RAND function is a mathematical function which returns a pseudo-random float value from 0 through 1, exclusive or a random value within any range. It can also take an optional seed parameter which is…

 433 total views,  3 views today

Read More...

How to insert the result of a stored procedure into table


Sometimes, you want to store the result of a stored procedure into table or temp table instead of returning the output. Storing output of stored procedure into table enables more option for you, such as…

 733 total views,  5 views today

Read More...

Delete Horizontal White Space in SQL Serve


When you are required to import data received from different different file format such as .txt, .csv., or excel files, sometimes you see a white spaces along with the data, which may create a problem…

 192 total views,  1 views today

Read More...

Date and Time Conversions in SQL Server


Sometimes you need to format a date in specific format such as format a date time string YYYY-MM-DD hh:mm:ss. mmm to date MM:DD:YY. SQL Server provides you a various options that you can use to…

 342 total views,  2 views today

Read More...

Get Row Counts for all tables in SQL Server


Sometime you are required to validate the row counts for each tables in database. So getting a row counts for each tables either through using a loop on each table or go and get row…

 708 total views,  13 views today

Read More...

Dynamic Data Masking in SQL Server


Dynamic data masking also known as DDM is a security feature in SQL Server which helps you to prevent the access of unauthorize users to sensitive data in the database. It was introduced in SQL…

 557 total views,  33 views today

Read More...

How to get Ordinal Number in SQL


If any number that is written like as 1st, 2nd, 3rd and so on.. is called an ordinal number, and it is read as 1st( first), 2nd(second), 3rd(third), 4th fourth respectively. By adding a letter…

 330 total views

Read More...

SQL Code Snippets


SQL code snippet is a template which contains the basic structure of a Transact-SQL statement or block, so that you can quickly write queries without any syntax errors. It was released in SQL Server 2012…

 521 total views,  4 views today

Read More...

DROP IF EXISTS


SQL Server 2016 has released an optional IF EXISTS clause with DROP statement that can be used as DROP IF EXISTS. DROP IF EXITS verify if an object exists then drops an existing object and…

 340 total views,  1 views today

Read More...

SQL Server Saving Changes is not permitted error


You might have faced an error as shown below, when you make some changes in table from design mode in SQL server management studio (SSMS). ‘Saving changes is not permitted. The change you have made…

 289 total views,  1 views today

Read More...