|
|
|
|
|
|
| Question of the Day |
Today's question (by Steve Jones - SSC Editor): | |
Hyperscale Replicas IV | |
| In Azure SQL Database Hyperscale Edition, how many geo-replicas can be created? | |
Think you know the answer? Click here, and find out if you are right. | |
| Yesterday's Question of the Day (by Steve Jones - SSC Editor) |
Using CHOOSE() We have this code that sets some status values and then queries them using the CHOOSE() function in SQL Server 2025. CREATE TABLE Status
(
StatusID INT,
StatusDescription VARCHAR(20)
);
GO
INSERT dbo.Status
(
StatusID,
StatusDescription
)
VALUES
(0, 'Uncategorized'),
(1, 'Active'),
(2, 'Inactive'),
(3, 'Temp');
GO
SELECT CHOOSE(StatusID, 'Unknown', 'Active', 'Inactive', 'Temporary')
FROM Status;
When the SELECT runs, what is returned? Answer: Four rows, with a NULL, then Unknown, Active, Inactive Explanation: CHOOSE() is an 1-index based function, so it expects 1, 2, 3, etc. as the values. This means that the 0 returns a NULL as the value is unknown. 1, 2, 3 in the Status table return the next 3 values in the statement. The 4th value, Temp, is not returned. Ref: CHOOSE() - https://learn.microsoft.com/en-us/sql/t-sql/functions/logical-functions-choose-transact-sql?view=sql-server-ver17 |
| Database Pros Who Need Your Help |
Here's a few of the new posts today on the forums. To see more, visit the forums. |
| SQL Server 2016 - Development and T-SQL |
| Force join by longest possible choice - Title pretty much says it. I want to join to a table that has entries like Sand and Sandstone, or Chert and Chert with striations. The table I am join to has these expressions as the leading text in a longer text field, so I am joining with trailing wildcards. If my table has the […] |
| Editorials |
| Risk Vs Reward, The never ending ROI discussion. - Comments posted to this topic are about the item Risk Vs Reward, The never ending ROI discussion., which is is not currently available on the site. |
| The DBA is Dead! Long Live the ! - Comments posted to this topic are about the item The DBA is Dead! Long Live the ! |
| It's Never Just One Thing - Comments posted to this topic are about the item It's Never Just One Thing |
| Let's Talk Certifications - Comments posted to this topic are about the item Let's Talk Certifications |
| Article Discussions by Author |
| Hyperscale Replicas IV - Comments posted to this topic are about the item Hyperscale Replicas IV |
| The SQL Server Date Magic: When CAST and CONVERT Keep Your Index Seek - Comments posted to this topic are about the item The SQL Server Date Magic: When CAST and CONVERT Keep Your Index Seek |
| Using CHOOSE() - Comments posted to this topic are about the item Using CHOOSE() |
| Re-Seeding a Broken Log Shipping Secondary (Without Touching the Primary) - Comments posted to this topic are about the item Re-Seeding a Broken Log Shipping Secondary (Without Touching the Primary) |
| Calculating Min-Max Normalization in PowerBI - Comments posted to this topic are about the item Calculating Min-Max Normalization in PowerBI |
| Checking the Error Log III - Comments posted to this topic are about the item Checking the Error Log III |
| The Hidden Security Risks of Role Combination in SSAS Tabular - Comments posted to this topic are about the item The Hidden Security Risks of Role Combination in SSAS Tabular |
| The Empty Aggregate - Comments posted to this topic are about the item The Empty Aggregate |
| SQL Server 2022 - Administration |
| Anyone knows where to download SQLexpress edition for 2022 - Where to download earlier version of SQL server express 2022? Thanks |
| SSL/TLS Cert Validity Periods Decreasing - Hi, to all of you who are using CA certs on SQL Server boxes to avoid the need to check that pesky 'Trust Server Certificate' box. It seems there is an industry-wide agreement to shorten the validity period of these certs, down to just 47 days in 2029: Shorter validity periods coming for SSL/TLS certificates: […] |
| |
| ©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. webmaster@sqlservercentral.com |