Sending a Variable Number of Elements in a Parameter
What are your options for sending a variable number of choices in a parameter to a stored procedure? Alex Grinberg looks at three techniques you can use.
2014-02-06
9,425 reads
What are your options for sending a variable number of choices in a parameter to a stored procedure? Alex Grinberg looks at three techniques you can use.
2014-02-06
9,425 reads
Longtime SQLServerCentral author, Alex Grinberg, brings us a short piece on how to deal with multi-valued parameters in Reporting Services when you have a stored procedure call.
2009-04-21
14,796 reads
With the advent of so many new technologies in the Microsoft space, a DBA needs to learn more and more about many of them that aren't a part of SQL Server. Alex Grinberg brings us a technique he has used to create ADO functions for your stored procedures.
2008-10-10
13,677 reads
SQL Server 2000 and Transact-SQL have many features, but one of the most often asked for features has been the implementation of some sort of array data type. This basic programming concept is notably absent from the development platform and results in many headaches and frustrations for DBAs. New author Alex Grinberg brings us his techniques for simulating arrays in SQL Server 2000.
2008-02-15 (first published: 2005-05-16)
144,856 reads
Optional parameters are easily handled with NULL values in T-SQL, but there are cases where this doesn't always work. Alex Grinberg brings us a new technique to allow your stored procedures to be structured to deal with this situation without dynamic SQL.
2006-10-09
9,120 reads
It's not recommended, but sometimes writing scripts against the system tables and getting information is a great way to work with SQL Server. Alex Grinberg brings us a look at some of the things you can get from system tables along with some sample scripts.
2006-01-16
14,535 reads
By Steve Jones
Finding duplicates was an interview question for me years ago, and I’ve never forgotten...
By HeyMo0sh
Over time, I’ve realised that one of the hardest parts of cloud management isn’t...
By HeyMo0sh
One of the biggest challenges I’ve faced in cloud operations is maintaining clear visibility...
Comments posted to this topic are about the item Fun with JSON II
Comments posted to this topic are about the item Changing Data Types
Comments posted to this topic are about the item Answering Questions On Dropped Columns
I have some data in a table:
CREATE TABLE #test_data
(
id INT PRIMARY KEY,
name VARCHAR(100),
birth_date DATE
);
-- Step 2: Insert rows
INSERT INTO #test_data
VALUES
(1, 'Olivia', '2025-01-05'),
(2, 'Emma', '2025-03-02'),
(3, 'Liam', '2025-11-15'),
(4, 'Noah', '2025-12-22');
If I run this query, how many rows are returned?
SELECT t1.[key] AS row,
t2.*
FROM OPENJSON(
(
SELECT t.* FROM #test_data AS t FOR JSON PATH
)
) t1
CROSS APPLY OPENJSON(t1.value) t2; See possible answers