Problems displaying this newsletter? View online.
SQL Server Central
Featured Contents
Question of the Day
Featured Script
The Voice of the DBA
 

Concerns over AI Chat Privacy

One of the major concerns for using GenAI tools is who is reading the data you submit as a prompt, and will this data be used in future training of the model? In other words, could someone using a future model access the data I put in a GenAI chat?

It's a valid concern, and not just because of the vendors. There is a lawsuit over the use of data by OpenAI, and a court has ordered all chats to be retained, including deleted ones. Since this is a lawsuit, there is always a chance that some of the data retained gets entered into a court document or even that it might be read aloud in court and captured in a transcript.

This is a thorny data privacy issue that collides with the need for courts to maintain evidence for legal proceedings. I honestly don't know what the answer here is, but I think this should be handled similarly to how code and other IP/proprietary items are handled as evidence. The challenge here is that there can be a lot of evidence, and I am not sure many legal organizations are really set up to handle and manage this much data.

I'm also not sure who I think should pay for this. If two parties engage in a lawsuit, but the data is actually held in custody by a third party. Do we need to have some nominal charge rate for keeping data that some need to prove their case? Is there a need to force companies like OpenAI and others to hold data in chats for a certain period of time? Something like the 7 or 10 years that a lot of governments require for tax records?

Our legal systems are outdated and ill-equipped to handle many ways in which the digital world differs from the analogue one. On one hand, I wish that lawmakers would work with advocates and technologists to update laws to make them more relevant, or perhaps, only applicable to digital data.

On the other, I worry about adding new laws that create overhead, perhaps stifle innovation, or will be out of date as soon as they are passed.

In 2025, we all should know that anything we send across the internet to another person or service could potentially be disclosed and abused. If that really bothers you, then beware of all free services and be cautious of the paid ones. Read the EULAs and decide if you can accept the risk.

Because once you send it, your data is out of your control.

Steve Jones - SSC Editor

Join the debate, and respond to today's editorial on the forums

 
 Featured Contents
Stairway to Hyperscale

Introduction of Azure SQL Hyperscale: Stairway to Azure SQL Hyperscale Level 1

Chandan Shukla from SQLServerCentral

In Level 1 of the Stairway to Azure SQL Hyperscale, we learn about the architecture and create a hyperscale instance.

External Article

How to Script Dimensions with data build tool (dbt) Macros

Additional Articles from SimpleTalk

In this article, we’ll revisit the dimension models we created. We wrote the entire SQL statement for the dimension by hand, and the dimensions themselves were very rudimentary; they lacked a surrogate key and there were no audit columns (such as insert date and update date). We’ll show you how we can expand the dimensions using Jinja, but also how we can minimize development effort by baking reusable patterns into the Jinja code.

Blog Post

From the SQL Server Central Blogs - Azure IoT Operations

James Serra from James Serra's Blog

I want to talk about a fairly new product that you may not be aware of: Azure IoT Operations, which GA’d last November (it was first announced at Ignite...

Blog Post

From the SQL Server Central Blogs - Adding a Named Default Constraint to a Table: #SQLNewBlogger

Steve Jones - SSC Editor from The Voice of the DBA

As part of a demo recently I was adding a default value to a new column with a simple DEFAULT and a value. Under the covers this creates a...

Refactoring Databases cover

Refactoring Databases: Evolutionary Database Design

Site Owners from SQLServerCentral

Refactoring has proven its value in a wide range of development projects–helping software professionals improve system designs, maintainability, extensibility, and performance.

 

 Question of the Day

Today's question (by Steve Jones - SSC Editor):

 

The Duplicate Cursor

Can I run this code:
DECLARE ANewTable CURSOR FOR 
SELECT * FROM ANewTable

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)

Change Tracking Default Retention

I run this command on my SQL Server 2022 database:

ALTER DATABASE AdventureWorks2017 SET CHANGE_TRACKING = ON;

What is the default data retention period?

Answer: 2 days

Explanation: The default retention period is 2 days. Ref: ALTER DATABASE - https://learn.microsoft.com/en-us/sql/t-sql/statements/alter-database-transact-sql-set-options?view=sql-server-ver16

Discuss this question and answer on the forums

 

Featured Script

Free T-SQL Script: Database Schema Documentation Generator for Generative AI Services Integration

inbathiru from SQLServerCentral

This script automatically generates comprehensive schema documentation that can be easily consumed by AI services for natural language querying, automated report generation, and intelligent data analysis.

-- =================================================================
-- AI-Ready Database Schema Documentation Generator
-- Purpose: Generate comprehensive schema documentation for
-- Generative AI Services integration
-- Author: SQL Server Central Community
-- Date: July 2025
-- =================================================================

-- Create temporary table to store schema information
CREATE TABLE #SchemaDoc (
TableName NVARCHAR(128),
ColumnName NVARCHAR(128),
DataType NVARCHAR(128),
MaxLength INT,
IsNullable BIT,
DefaultValue NVARCHAR(256),
IsPrimaryKey BIT,
IsForeignKey BIT,
ReferencedTable NVARCHAR(128),
ReferencedColumn NVARCHAR(128),
ColumnDescription NVARCHAR(500)
);

-- Populate schema information
INSERT INTO #SchemaDoc
SELECT
t.TABLE_NAME,
c.COLUMN_NAME,
c.DATA_TYPE +
CASE
WHEN c.CHARACTER_MAXIMUM_LENGTH IS NOT NULL
THEN '(' + CAST(c.CHARACTER_MAXIMUM_LENGTH AS VARCHAR(10)) + ')'
WHEN c.NUMERIC_PRECISION IS NOT NULL
THEN '(' + CAST(c.NUMERIC_PRECISION AS VARCHAR(10)) + ',' + CAST(c.NUMERIC_SCALE AS VARCHAR(10)) + ')'
ELSE ''
END AS DataType,
c.CHARACTER_MAXIMUM_LENGTH,
CASE WHEN c.IS_NULLABLE = 'YES' THEN 1 ELSE 0 END,
c.COLUMN_DEFAULT,
CASE WHEN pk.COLUMN_NAME IS NOT NULL THEN 1 ELSE 0 END AS IsPrimaryKey,
CASE WHEN fk.COLUMN_NAME IS NOT NULL THEN 1 ELSE 0 END AS IsForeignKey,
fk.REFERENCED_TABLE_NAME,
fk.REFERENCED_COLUMN_NAME,
COALESCE(ep.value, 'No description available') AS ColumnDescription
FROM INFORMATION_SCHEMA.TABLES t
INNER JOIN INFORMATION_SCHEMA.COLUMNS c ON t.TABLE_NAME = c.TABLE_NAME
LEFT JOIN (
SELECT ku.TABLE_NAME, ku.COLUMN_NAME
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc
INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE ku
ON tc.CONSTRAINT_NAME = ku.CONSTRAINT_NAME
WHERE tc.CONSTRAINT_TYPE = 'PRIMARY KEY'
) pk ON c.TABLE_NAME = pk.TABLE_NAME AND c.COLUMN_NAME = pk.COLUMN_NAME
LEFT JOIN (
SELECT
ku.TABLE_NAME,
ku.COLUMN_NAME,
ku2.TABLE_NAME AS REFERENCED_TABLE_NAME,
ku2.COLUMN_NAME AS REFERENCED_COLUMN_NAME
FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS rc
INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE ku
ON rc.CONSTRAINT_NAME = ku.CONSTRAINT_NAME
INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE ku2
ON rc.UNIQUE_CONSTRAINT_NAME = ku2.CONSTRAINT_NAME
) fk ON c.TABLE_NAME = fk.TABLE_NAME AND c.COLUMN_NAME = fk.COLUMN_NAME
LEFT JOIN sys.extended_properties ep ON ep.major_id = OBJECT_ID(t.TABLE_SCHEMA + '.' + t.TABLE_NAME)
AND ep.minor_id = COLUMNPROPERTY(OBJECT_ID(t.TABLE_SCHEMA + '.' + t.TABLE_NAME), c.COLUMN_NAME, 'ColumnId')
WHERE t.TABLE_TYPE = 'BASE TABLE'
ORDER BY t.TABLE_NAME, c.ORDINAL_POSITION;

-- Generate AI-friendly documentation
SELECT
'=== TABLE: ' + TableName + ' ===' AS Documentation
FROM #SchemaDoc
GROUP BY TableName
UNION ALL
SELECT
'• ' + ColumnName + ' (' + DataType + ')' +
CASE WHEN IsPrimaryKey = 1 THEN ' [PRIMARY KEY]' ELSE '' END +
CASE WHEN IsForeignKey = 1 THEN ' [FOREIGN KEY → ' + ReferencedTable + '.' + ReferencedColumn + ']' ELSE '' END +
CASE WHEN IsNullable = 0 THEN ' [NOT NULL]' ELSE '' END +
' - ' + ColumnDescription
FROM #SchemaDoc
ORDER BY TableName, ColumnName;

-- Generate JSON format for API integration
SELECT
TableName,
(
SELECT
ColumnName,
DataType,
IsNullable,
IsPrimaryKey,
IsForeignKey,
ReferencedTable,
ReferencedColumn,
ColumnDescription
FROM #SchemaDoc s2
WHERE s2.TableName = s1.TableName
FOR JSON PATH
) AS Columns
FROM #SchemaDoc s1
GROUP BY TableName
FOR JSON PATH;

-- Cleanup
DROP TABLE #SchemaDoc;

More »

 

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 - Administration
Object owner question - Hello, Currently all of our tables e.t.c are owned by dbo. In one of our databases I need to move the tables to a different owner to prevent an ownership chain. What I'm a bit unsure about is the best type of account to use for the table owner. I think 'user without login' is […]
SQL Server 2016 - Development and T-SQL
Encryption or Certificate - Trying to NOT put hardcoded password in Proc - We have a few stored procs where we need to a dos command "net use" EXEC master..xp_cmdshell 'NET USE \\\ /USER:<domain\username>    /PERSISTENT:yes'   I am trying to figure out a way to retrieve a password stored somewhere that is obfuscated from nefarious people, via encryption or any other way really, So that […]
SQL Server 2019 - Development
Next dates - CREATE TABLE ADMITS ( ID_NUM INT varchar(15) null ,provider_id varchar(15) null ,provider_name varchar(36) null ,ADMIT_DATE DATE NULL ,DISCHARGE_DATE DATE NULL ,swpa_description varchar(max) null ,date_dispensed DATE NULL ,drug_name varchar(max) null ,discharge_to_dispensed int ) INSERT INTO ADMITS (ID_NUM,provider_id,provider_name, ADMIT_DATE, DISCHARGE_DATE,swpa_description,date_dispensed,discharge_to_dispensed) VALUES ('008012773','006467','WHITE DEER RUN LLC', '2024-02-06', '2024-02-11','Residential Detox, Rehab, HWH (non hosp)','2024-02-22','GABAPENTIN, 300 MG ORAL CAPSULE',11) ,('008012773','006467','WHITE […]
Amazon AWS and other cloud vendors
Moving a database from AWS RDS Custom to RDS Standard - Having real fun with this. It isn't possible to set the option group, to enable the AWS SQL backup routines, because you can't execute the CloudShell command to assign an options group (aws rds modify-db-instance), in RDS Custom. I can't restore an RDS Custom snapshot, because that will just create another RDS Custom, and I […]
Reporting Services
2 table designs within one section to keep data for one section value within one - My requirement is to display data for  a number of routes within 2 tables and keep everything in one page where each value for the route generates a new page. I have created a group for route calling it 'sectie1'  and set proper behavior for this sectie (page break, having headers on each page etc). […]
Editorials
Ghostworkers - Comments posted to this topic are about the item Ghostworkers
T-SQL
Backup information incorrect after AAG toggle - Good morning all, I have the attached T-SQL query that has been working well for sometime. This past Saturday during patching, the AAG toggled from primary on server1 to primary on server2. Now the query does not report differentials from the current primary server. Any pointer/suggestions on what I fail to see is greatly appreciated. […]
Backup information incorrect after AAG toggle - Good morning all, I have the attached T-SQL query that has been working well for sometime. This past Saturday during patching, the AAG toggled from primary on server1 to primary on server2. Now the query does not report differentials from the current primary server. Any pointer/suggestions on what I fail to see is greatly appreciated. […]
Article Discussions by Author
Fetch fields like email address from multiple records into single cell - Comments posted to this topic are about the item Fetch fields like email address from multiple records into single cell
Enables Change Data Capture (CDC) on all user databases - Comments posted to this topic are about the item Enables Change Data Capture (CDC) on all user databases
Free T-SQL Script: Database Schema Documentation Generator for Generative AI Services Integration - Comments posted to this topic are about the item Free T-SQL Script: Database Schema Documentation Generator for Generative AI Services Integration
Fetch fields like email address from multiple records into single cell - Comments posted to this topic are about the item Fetch fields like email address from multiple records into single cell
Using psycopg2 to Connect Python to PostgreSQL - Comments posted to this topic are about the item Using psycopg2 to Connect Python to PostgreSQL
SQL Server 2022 - Development
Trying Different CTAs in Car Insurance Ads, Any Tips - Hey everyone, I’ve been experimenting a bit with digital ads for car insurance, and one thing that keeps confusing me is how small changes in call-to-action buttons can really affect clicks. I figured I’d share what I’ve noticed so far and maybe get your thoughts too. Pain Point So here’s the deal. I was running […]
ssms aborting in object explorer details - Hi i just set up a new pc after my touch pad went bad.  our tech guy installed a version of ssms that says its this  SQL Server Management Studio 21.4.12+5.36408.4.  its not the version i used before.   I'm not 100% certain what image he uses to set up a new pc. I'm getting the […]
 

 

RSS FeedTwitter

This email has been sent to {email}. To be removed from this list, please click here. If you have any problems leaving the list, please contact the webmaster@sqlservercentral.com. This newsletter was sent to you because you signed up at SQLServerCentral.com.
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved.
webmaster@sqlservercentral.com

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -