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...

SQL NULLIF


SQL NULLIF expression compares two expression and returns a null value if the two specified expressions are equal, else it returns the first expression. NULLIF  expression is equivalent to a searched CASE expression in which…

 210 total views

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…

 163 total views,  3 views today

Read More...

How to Update from Select Statement in SQL


SQL Server update statement is used used to modify an existing records in a table, you can also update records in table based on some specific conditions. Following is the basic syntax of update statement….

 614 total views,  1 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...

SQL Delete TOP


SQL delete statement is used to delete records from table based on specific conditions which are specified in where clause. Delete statement can also be used as Delete TOP, which also allows you to use…

 498 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...

SQL SELECT TOP


SQL SELECT TOP statement is used to retrieve records from tables and limit the number of rows or percentage of rows returned based on a specified value. It is also known as TOP Clause or…

 240 total views,  6 views today

Read More...

Table Value Constructor


Table Value Constructor (TVC) allows to group multiple rows of data in a single DML statement. It can be used as a part of either the VALUES clause of an INSERT INTO VALUES statement, or…

 305 total views

Read More...

SQL Correlated Subquery


A correlated subquery is a subquery that uses the values of the outer query and it is evaluated for each row processed by the outer query. A correlated subquery always depends on outer query for…

 360 total views,  1 views today

Read More...

SQL Over Clause


SQL OVER clause allows the use of aggregation without using a group by clause. OVER caluse aggregate rows across groups of another field using the PARTITION BY Clause. It can be used with functions to…

 756 total views,  7 views today

Read More...

SQL ROUND Function


The SQL ROUND function is a SQL Mathematical Function which is used to round a number to a specified length or precision. It returns a numeric value. It always returns a value. It returns 0,…

 84 total views,  1 views today

Read More...

SQL NOT NULL Constraint


SQL NOT NULL Constraint is used to prevent inserting NULL values into the specified column. When value for any specific column is not provided while inserting, or updating a record into a table, by default…

 88 total views

Read More...

SQL Between Operator


SQL Between Operator is a logical operator that selects the records whose values are in between the given values. SYNTAX SELECT * FROM table_name WHERE  test_expression [ NOT ] BETWEEN begin_expression AND end_expression; test_expression is…

 74 total views,  1 views today

Read More...

SQL Subquery


 A Subquery is a query within another query. The outer query is called as main query and inner query is called as subquery. A subquery (inner query) executes first then main query (outer query) executes and…

 280 total views,  1 views today

Read More...

SQL EXISTS Operator


The SQL EXISTS Operator is used to check the existence of any record in a subquery. The EXISTS operator returns true if the subquery returns one or more records. SYNTAX SELECT column_name(s) FROM table_name WHERE EXISTS (SELECT column_name FROM table_name WHERE condition);  …

 106 total views,  1 views today

Read More...

SQL Attach Database


Detaching and attaching a SQL database, is helpful in case in case when you want to move to move a database to a different SQL Server instance. So Bascially, first we detach database from SQL Server and move those files to another SQL Server and then attach files.

 180 total views,  1 views today

Read More...
detachdatabase

SQL Detach Database


SQL Detach Database, when you detach a database from SQL Server, database is removed from the instance of SQL Server but kept the database intact within its data files and transaction log files.

 154 total views

Read More...

SQL Default Constraint


The DEFAULT constraint is used to provide a default value for a columns, when the INSERT INTO statement does not provide a specific value to columns.

 251 total views,  1 views today

Read More...

SQL Server Cross Apply and Outer Apply


SQL Server Cross Apply and Outer Apply

SQL Server APPLY operator is like a SQL JOINS, which allows joining two table expressions, but the Difference between APPLY operator and JOINS is the ability of APPLY operator to work with table- valued expression.

 433 total views

Read More...