2008-10-10 (first published: 2008-07-20)
1,890 reads
2008-10-10 (first published: 2008-07-20)
1,890 reads
This script was designed to 'pivot' data that couldnt easily be pivoted in any other way. i used temporary tables to eventually achieve the result i was looking for 🙂
2008-10-10
1,049 reads
It is very common to want to drop a table, if it exists, before creating it. This script does so, and it works well with temp tables (where the system views are harder to query).
2008-10-06
2,709 reads
All of us have problems with Duplicate rows, here is a simple and efficient way of removing duplicate rows
2008-10-03 (first published: 2008-07-18)
1,684 reads
How to use DDL triggers and Query the Data with minimum performance impact.
2008-10-02
1,828 reads
2008-09-30 (first published: 2008-07-24)
883 reads
A short script you can incorporate into any 2005/2008 code to get the full schema.table.
2008-09-29
660 reads
Script to return Rows count from table using sp_ExecuteSQL
2008-09-26 (first published: 2008-07-20)
1,541 reads
When a value is changed that causes an error, finding what caused the error can be tricky. Here an application was truncating a column. The trigger helped to identify the culprit.
2008-09-25 (first published: 2008-07-17)
1,400 reads
A quick script to check for fragmentation in a database and generate a list of defrag statments you can run.
2008-09-24
2,473 reads
If you've ever loaded a 2 GB CSV into pandas just to run a...
By James Serra
What problem is Fabric Ontology trying to solve? For years, most data conversations have...
By Steve Jones
Recently I ran across some code that used a lot of QUOTENAME() calls. A...
Comments posted to this topic are about the item The New Software Team
Comments posted to this topic are about the item Database Mail in SQL Server...
Comments posted to this topic are about the item The string_agg function
We create the following table and then insert some records in it:
create table t1 ( id int primary key, category char(1) not null, product varchar(50) ); insert into t1 values (1, 'A', 'Product 1'), (2, 'A', 'Product 2'), (3, 'A', 'Product 3'), (4, 'B', 'Product 4'), (5, 'B', 'Product 5');What happens if we execute the following query in both Sql Server and PostgreSQL?
select id,
category,
string_agg(product, ';')
over (partition by category order by id
rows between unbounded preceding and unbounded following) as stragg
from t1; See possible answers