Technical Article

t-sql function to parse string data

The below function can be used to parse or split out data from a delimited string. The function takes in 3 parameters. The text you want to parse, the 1 character delimiter, and the total count of objects in the text.Text for function is set at size of varchar(2000), feel free to make bigger if […]

You rated this post out of 5. Change rating

2005-01-19 (first published: )

1,856 reads

Technical Article

Script to gain capacity information

Recently at my site we had a need to gather current capcatiy of all databases as well as table obejcts on our servers.  although there are some out of the box stored proceudres to assist in this effort as well as some schema objects, they mostly would return information on one database at a time.  […]

5 (2)

You rated this post out of 5. Change rating

2002-09-20

271 reads

Blogs

Webinar tomorrow: The Role of Databases in the Era of AI

By

I’m hosting a webinar tomorrow with Rie Merritt from Microsoft. We’ll be talking about...

Spark Connect Dotnet Variant Data Type

By

All Spark Connect Posts I recently published the latest version of the Spark Connect Dotnet...

A New Word: Opia

By

opia – n. the ambiguous intensity of eye contact The entry for this says...

Read the latest Blogs

Forums

Table Partitioning SQL server 2022

By Saran

Hi All, I am currently testing the Table Partitioning to implement in SQL server...

STRING_AGG's behavior

By Alessandro Mortola

Comments posted to this topic are about the item STRING_AGG's behavior

The Role of Databases in the Era of AI

By Steve Jones - SSC Editor

Comments posted to this topic are about the item The Role of Databases in...

Visit the forum

Question of the Day

STRING_AGG's behavior

Executing the following script (Sql Server 2022), you get the table t0 with 10 rows:
CREATE TABLE t0
( id     INT PRIMARY KEY
, field1 VARCHAR(1000)
, field2 VARCHAR(MAX));
INSERT INTO t0
SELECT
  gs.value
, REPLICATE ('X', 1000)
, REPLICATE ('Y', 1000)
FROM generate_series(1, 10, 1) gs;
GO
What happens if you execute the following statements?
  1. select STRING_AGG(field1, ';') within group (order by id)  from t0;
  2. select STRING_AGG(field2, ';') within group (order by id)  from t0;

See possible answers