|
|
|
|
|
|
|
| Question of the Day |
Today's question (by Steve Jones - SSC Editor): | |
Deprecated Feature Tracking | |
| From T-SQL, without requiring an XEvent session, can I tell which deprecated features are being used on my instance? | |
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) |
A Big PK In SQL Server 2025, how many columns can be included in a Primary Key constraint? Answer: 32 Explanation: You can have 32 columns in a PK constraint. This is the same number as SQL Server 2016, 2017, 2019, 2022 (tested). You can test this with this code: -- GO statements are causing syntax errors when running in NOEXEC mode
-- Replacing GO batch separators with semicolons to execute as a single batch
DROP TABLE IF EXISTS dbo.PKTest;
CREATE table PKTest
(
c01 int not null,
c02 int not null,
c03 int not null,
c04 int not null,
c05 int not null,
c06 int not null,
c07 int not null,
c08 int not null,
c09 int not null,
c10 int not null,
c11 int not null,
c12 int not null,
c13 int not null,
c14 int not null,
c15 int not null,
c16 int not null,
c17 int not null,
c18 int not null,
c19 CHAR(100) not NULL,
c20 char(100) not null,
c21 char(100) not null,
c22 char(100) not null,
c23 char(100) not null,
c24 char(100) not null,
c25 char(100) not null,
c26 char(104) not null,
c27 int not null,
c28 int not null,
c29 int not NULL,
c30 int not NULL,
c31 int not NULL,
c32 int not NULL,
c33 int not null
);
go
alter table dbo.PKTest
add constraint PKTestPK
PRIMARY KEY (
c01, c02, c03, c04,c05, c06, c07, c08, c09, c10,
c11, c12, c13, c14, c15, c16, c17, c18, c19, c20,
c21, c22, c23, c24, c25, c26, c27, c28, c29, c30,
c31, c32
);
GOThe docs (as of Dec 1, 2025) still say 16 columns, but I have submitted a PR. Ref: Primary Keys - https://learn.microsoft.com/en-us/sql/relational-databases/tables/primary-and-foreign-key-constraints?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 2017 - Development |
| Pivot but preserve all rows on Aggregate column - Hello Need help in pivoting this data set, the Pivot takes MIN/MAX on a column and creates only row, my goal is to preserve all rows. We need to pivot on DSTRCT_CODE which will have only two values {BBBB/CCCC} on value of column PREF_PART_IND. so for below sample data : with q_data as ( select […] |
| SQL Server 2019 - Administration |
| MAX_DISPATCH_LATENCY in extended event , is not clearly explained in msdn. - hi, i have checked reducing it increasing it but could not get any thing, pls explain what exactly it means. DROP EVENT SESSION [CaptureSlowQueries] ON SERVER go CREATE EVENT SESSION [CaptureSlowQueries] ON SERVER ADD EVENT sqlserver.sp_statement_completed( ACTION(sqlserver.database_id,sqlserver.sql_text) WHERE ([duration]>(15000000))), ADD EVENT sqlserver.sql_statement_completed(SET collect_statement=(1) ACTION(sqlserver.client_app_name,sqlserver.database_id,sqlserver.sql_text) WHERE ([duration]>(15000000) )) ADD TARGET package0.event_file(SET filename=N'SlowQueries',max_file_size=(5),max_rollover_files=(2)) WITH (MAX_MEMORY=4096 KB,EVENT_RETENTION_MODE=ALLOW_SINGLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=30 […] |
| SQL Server 2019 - Development |
| is there a no code way to limit an ssis extract from excel to the 1st 21 rows? - is there a no code way to limit an ssis extract from excel to the 1st 21 rows of the sheet? for now anything past that is just noise in what im doing. |
| any reason to avoid asking ssis to extract files from ftp - hi we have to replace talend which generally was used to move files. talend's replacement except for a handful of sql sourced etl's is an OO code based "pipeline" architecture. the sql stuff has been converted to ssis. we have to begin extracting about 6 files daily from an ftp server and throwing them out […] |
| CAST datetimeoffset(7) as a datetime in UK format - I have a view where I am casting a datetimeoffset(7) field to smalldatetime or datetime as my reporting application won't accept the datetimeoffset(7) format. Problem is I am trying to get this field to show up in UK format. I am using CAST to get my results. I can get the format I need by […] |
| what are the downsides of TDE not running vs running? - hi for the 2 years i've been here I believe we've had "encryption" turned off in what i only know as the way we tell ssms to communicate with our sql servers ...and i've always thought meant also the server itself relaxing how it communicates back to whatever client is asking for data. recently an […] |
| Reporting Services |
| Catalog max connection pool size: 100 - Seeing this message repeated every 10 seconds in the RSHostingService_yyyy_mm_dd_hh_mm_ss.log file. Can anyone advise: a) Why this is being reported so frequently? b) Does it indicate the limit is being hit? c) If b is true, how can I increase it? I've had a look through the configuration files and can't find anything specifying "100" […] |
| Editorials |
| Investing for AI - Comments posted to this topic are about the item Investing for AI, which is is not currently available on the site. |
| Article Discussions by Author |
| What is the PRODUCT - Comments posted to this topic are about the item What is the PRODUCT |
| Metadata Driven Pipelines (Incremental Load): The Fabric Modern Data Platform - Comments posted to this topic are about the item Metadata Driven Pipelines (Incremental Load): The Fabric Modern Data Platform |
| Metadata Driven Pipelines (Incremental Load): The Fabric Modern Data Platform - Comments posted to this topic are about the item Metadata Driven Pipelines (Incremental Load): The Fabric Modern Data Platform |
| Unlocking Data Transformation: My journey with dbt (Data Build Tool) on SQL Server - Comments posted to this topic are about the item Unlocking Data Transformation: My journey with dbt (Data Build Tool) on SQL Server |
| SQL Server 2022 - Administration |
| Help! MEMORY_ALLOCATION_EXT wait stalls - Hi I have an overnight process that moves allot of claims records Been working fine for many years. Now it hits this part of the code (across a linked server) and gets the (1596567ms)MEMORY_ALLOCATION_EXT wait type and will sit there forever and never move any records - no delta movements at all. Used to complete […] |
| SQL Server 2022 - Development |
| cant process ssas db on vm - error says source is encrypted and other things - hi i get the error you see below when trying to process my AR cube full. it is sourced by a sql db on the same server that theoretically is being connected to by my admin acct. my query on which sql engine db's might be encrypted comes up false on each. i made sure […] |
| This doesn't make sense to me - making me crazy - er - Hi So I have the below select query that won't return results if I have it this way: --DOES NOT RETURN-- AND EXISTS (SELECT 1 FROM edi.dbo.PEC_RGT_EDI_834_Inbound_Exception xx WHERE (xx.SubscriberNumber = x.subscribernumber OR x.MBI = xx.mbi) AND xx.LastDateProcessed>'05/31/2022') But will return results with this very small change: --DOES RETURN-- REPLACE ABOVE WITH BELOW AND […] |
| |
| ©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. webmaster@sqlservercentral.com |