SSMS Truncates my request?

I use SQL Server Management Studio 2012 on Windows Server 2012. When I run a query that includes PERCENTILE_CONT , which contains more than 8000 bytes, SSMS truncates my query, causing syntax errors when they are not there. No, I DO NOT perform a dynamic query using EXEC - I do not think this has anything to do with the length limit for strings.

See the following simple query, for example, adding about 10,000 spaces to an empty string (stackoverflow automatically truncates it, so I cannot provide you with a perfect copy / paste). This causes a syntax error below.

  • Simple removal of extraneous spaces without changing the functional code eliminates the problem and allows you to correctly analyze and execute the request as expected.

  • Also, recording a very long request without PERCENTILE_CONT does not reproduce this problem.

  • Switching to another database on the same server and running a sample request DOES NOT reproduce the problem.

How to fix this in real database queries or settings? I have a long request that includes PERCENTILE_CONT , and I cannot execute it because SSMS only parses and tries to fulfill part of my request. None of the above fixes is a viable option for my case.

Error:

Msg 102, Level 15, State 1, Line 5 Invalid syntax next to '('.

Query:

 DECLARE @Machines TABLE (MachineID INT) SELECT PERCENTILE_CONT(0.25) WITHIN GROUP (ORDER BY MachineID) OVER (PARTITION BY MachineID) FROM @Machines --REPLACE THIS COMMENT WITH 10,000 SPACES SELECT 2 

PasteBin request, including spaces: http://pastebin.com/q1Sv4KUE

SQL version I am using: Microsoft SQL Server 2012 (SP1) - 11.0.3153.0 (X64) July 22, 2014 15:26:36 Copyright (c) Microsoft Enterprise Edition: kernel-based licensing (64-bit) in Windows NT 6.2 (build 9200 :)

SQL compatibility level: 110

Management Studio Version Information:

Microsoft SQL Server Management Studio 11.0.5058.0 Microsoft Analysis Services 11.0.5058.0 Client Tools Microsoft Data Access Components (MDAC) 6.2.9200.16384 Microsoft MSXML 3.0 4.0 6.0 Microsoft Internet Explorer 9.10.9200.17296 Microsoft.NET Framework 4.0.30319.34209 Operating System 6.2.9200

+5
source share

All Articles