Search results
24 maj 2014 · In SQL Server, is there a way to search (and format) a result for a certain string (like preg_match in PHP): SELECT (IF (col1 contains 'http'){'<a>' + col 1 + '</a>'} else {'<b>' + col1 + '</b>'}), col2. FROM Table.
The Transact-SQL statement that follows an IF keyword and its condition is executed if the condition is satisfied: the Boolean expression returns TRUE. The optional ELSE keyword introduces another Transact-SQL statement that is executed when the IF condition isn't satisfied: the Boolean expression returns FALSE .
12 maj 2024 · In many SQL operations, it’s necessary to identify rows where a specific word or phrase exists within a particular column. This capability is crucial for filtering data and retrieving relevant information for the analysis.
12 wrz 2022 · SQL ELSEIF and ELSE Condition. Like many other programming languages, T-SQL can pair the IF keyword with ELSE IF and ELSE to more easily check multiple mutually exclusive scenarios. When combined, the first statement must be a single IF statement. This can be optionally followed by one or more ELSE IF statements.
Using the CASE statement. This is most easily accomplished in all versions of SQL Server using the CASE statement, which acts as a logical IF...THEN...ELSE expression and returns various values depending on the result.
7 gru 2023 · If you want to do if-else-then logic in select, where or anywhere else in a statement, you need a case expression. This is a series of when clauses that the database runs in order: For example, if you want to map exam correct percentages to grade letters according to these rules:
31 maj 2023 · SELECT * FROM MyTable WHERE CONTAINS(Column1,'word1 and word2 and word3', 1) > 0. If you need any of the words. SELECT * FROM MyTable WHERE CONTAINS(Column1,'word1 or word2 or word3', 1) > 0. Contains need index of type CONTEXT on your column.