<< < 2 3 4 5 6 7 8 9 10 11 12 > >>   Sort: Rank

NULL Values Involved in Datetime Operations in SQL Server
What Happens If NULL Values Are Involved in Datetime Operations in SQL Server Transact-SQL? If NULL values are involved in datetime operations, the result will be datetime NULL values. The following tutorial script shows you some good examples: USE FyiCenterData; GO SELECT GETDATE()+NULL; GO -------...
2017-02-05, 238👍, 0💬

ISNULL() - Replacing NULL Values in Expressions in SQL Server
How To Replace NULL Values in Expressions using ISNULL() in SQL Server Transact-SQL? As you learned from previous tutorials, NULL values presented in expressions will cause the final results to be NULL. Sometimes, you want NULL values to be replaced with some default values, like 0, '', or 'NULL', s...
2017-02-03, 316👍, 0💬

NULL Values Involved in Boolean Operations in SQL Server
What Happens If NULL Values Are Involved in Boolean Operations in SQL Server Transact-SQL? If NULL values are involved in Boolean operations, the result will vary depending on the operator type. For AND operator, FALSE takes precedence over NULL. The result can be summarized in a table below: AND TR...
2017-02-03, 279👍, 0💬

"IS NULL" - Testing NULL Values in SQL Server
How To Test NULL Values Properly in SQL Server Transact-SQL? From previous tutorials, you learned that comparing expressions with NULL will always result NULL. So you can not use comparison operators to test if an expression represents a NULL value or not. To test expressions for NULL values, you sh...
2017-02-03, 278👍, 0💬

NULL Values Involved in Bitwise Operations in SQL Server
What Happens If NULL Values Are Involved in Bitwise Operations in SQL Server Transact-SQL? If NULL values are involved in bitwise operations, the result will be binary NULL values. The following tutorial script shows you some good examples: SELECT 1 | NULL; GO ----------- NULL SELECT 707 & NULL;...
2017-02-03, 276👍, 0💬

NULL Values Involved in Comparison Operations in SQL Server
What Happens If NULL Values Are Involved in Comparison Operations in SQL Server Transact-SQL? If NULL values are involved in comparison operations, the result will be Boolean NULL values. This behavior is very interesting because you would expect a comparison operation returns only one of the two va...
2017-02-03, 268👍, 0💬

NULLIF() - Replacing Given Values with NULL in SQL Server
How To Replace Given Values with NULL using NULLIF() in SQL Server Transact-SQL? Sometime you want to hide certain values by replacing them with NULL values. SQL Server offers you a nice function called NULLIF() to do this: NULLIF(expression, value) -- Returns NULL if "expression" equals to value" -...
2017-01-29, 327👍, 0💬

What Is a Boolean Value in SQL Server
What Is a Boolean Value in SQL Server Transact-SQL? A Boolean value indicates a condition in a state of TRUE or FALSE. In Transact-SQL language, there is not storage data type defined to store a Boolean value. So Boolean values can only exist temporarily as part of the execution of Transact-SQL expr...
2017-01-29, 284👍, 0💬

CASE - Conditional Expressions in SQL Server
What Are Conditional Expressions in SQL Server Transact-SQL? A conditional expression returns one of the given expressions based a specific condition. SQL Server 2005 offers the CASE operator to present a conditional expression with two syntaxes: 1. CASE with simple conditions CASE test_value WHEN v...
2017-01-29, 279👍, 0💬

What Are Comparison Operations in SQL Server
What Are Comparison Operations in SQL Server Transact-SQL? Comparison operations return Boolean values by comparing the relative positions of two operands. SQL server supports the following comparison operations: = (Equal To): Returns Boolean true, if two operands are equal in value. > (Greater T...
2017-01-29, 275👍, 0💬

Boolean Values and Logical Operations in SQL Server Transact-SQL
Where to find answers to frequently asked questions on Boolean Values and Logical Operations in SQL Server Transact-SQL? Here is a list of frequently asked questions and their answers compiled by FYIcenter.com DBA team on Boolean Values and Logical Operations in SQL Server Transact-SQL. Clear answer...
2017-01-29, 272👍, 0💬

Performing Comparison on Date and Time Values in SQL Server
How To Perform Comparison on Date and Time Values in SQL Server Transact-SQL? Comparison operations on date and time values can be performed in the same way as numeric values. The comparison rule is simple: a date and time value in the future has a greater value than a date and time value in the pas...
2017-01-21, 296👍, 0💬

Performing Comparison on Exact Numbers in SQL Server
How To Perform Comparison on Exact Numbers in SQL Server Transact-SQL? Comparison operations on exact numbers of data types: BIT, INT, NUMERIC, etc., are very easy to understand. Here are some simple examples: -- BIT value comparison DECLARE @x BIT, @y BIT; SET @x = 0; SET @y = 1; SELECT CASE WHEN @...
2017-01-21, 293👍, 0💬

BETWEEN - Testing Value in a Range in SQL Server
What To Test Value Ranges with the BETWEEN Operator in SQL Server Transact-SQL? Sometimes you want to compare a value against a value range. You can do this with two regular comparison operations. But you can also use the special comparison operator BETWEEN to get it done with the following syntaxes...
2017-01-21, 285👍, 0💬

Using Wildcard Characters in LIKE Operations in SQL Server
How To Use Wildcard Characters in LIKE Operations in SQL Server Transact-SQL? Wildcard character '%' can be used in the pattern string for the LIKE operator to match any string of zero or more characters. The following example uses '%Sport% Store' to search all company names that has a partial word ...
2017-01-21, 281👍, 0💬

EXISTS - Testing Subquery Results in SQL Server
How To Test Subquery Results with the EXISTS Operator in SQL Server Transact-SQL? EXISTS is a special operator used to test subquery results. EXISTS can be used in two ways: EXISTS (SELECT ...) -- Returns TRUE if the specified subquery has one or more rows returned. NOT EXISTS (SELECT ...) -- Return...
2017-01-21, 266👍, 0💬

Performing Comparison on Character Strings in SQL Server
How To Perform Comparison on Character Strings in SQL Server Transact-SQL? Comparison operations on character strings are performed based on the associated collation. Each collation defines rules on how characters are ordered, how character cases and accents are treated, etc. The tutorial exercise b...
2017-01-21, 252👍, 0💬

Performing Comparison on Floating Point Numbers in SQL Server
How To Perform Comparison on Floating Point Numbers in SQL Server Transact-SQL? Comparison operations on approximate (floating point) numbers are also easy to understand. Just watch out rounding operations performed during conversions. Here are two examples of floating point number comparisons: -- R...
2017-01-21, 249👍, 0💬

LIKE - Matching a Pattern in a Character String in SQL Server
What To Perform Pattern Match with the LIKE Operator in SQL Server Transact-SQL? Pattern match is a very important operation for search records base on character string columns. SQL Server 2005 offers the LIKE operator to perform pattern match operations in two formats: target_string LIKE pattern --...
2017-01-21, 243👍, 0💬

IN - Testing Value in a Value List in SQL Server
What To Test Value Lists with the IN Operator in SQL Server Transact-SQL? Sometimes you want to test a given value against a list of values. You can do this in a loop with the regular "equal" operator. But you can also use the special comparison operator IN to get it done with the following syntaxes...
2017-01-21, 231👍, 0💬

IN - Testing Values Returned by a Subquery in SQL Server
How To Test Values Returned by a Subquery with the IN Operator in SQL Server Transact-SQL? Normally, the comparison operator IN is used against a list of specified values as in the format of: "test_value IN (value_1, value_2, ..., value_n)". But you can also replace the list of values by a subquery ...
2017-01-21, 221👍, 0💬

What Are Logical/Boolean Operations in SQL Server
What Are Logical/Boolean Operations in SQL Server Transact-SQL? Logical (Boolean) operations are performed on Boolean values with logical operators like 'AND', 'OR', or 'NOT'. Logical operations return Boolean values. SQL Server 2005 supports the following logical operations: AND - Returns TRUE if b...
2017-01-11, 377👍, 0💬

WHILE ... Loops in SQL Server Transact-SQL
How to execute statements in loops in SQL Server Transact-SQL? How to use WHILE ... loops? You can use WHILE ... statements to execute statements in loops in Transact-SQL using these syntaxes: -- Loop with a single statement WHILE condition statement -- Loop with a statement block WHILE condition --...
2017-01-11, 459👍, 0💬

IF ... ELSE Statement in SQL Server Transact-SQL
How to execute statements under given conditions in SQL Server Transact-SQL? How to use IF ... ELSE statements? You can use IF ... ELSE statements to execute statements under given conditions in Transact-SQL using these syntaxes: IF condition statement_1 IF condition statement_1 ELSE statement_2 IF ...
2017-01-11, 442👍, 0💬

<< < 2 3 4 5 6 7 8 9 10 11 12 > >>   Sort: Rank