Comments (6)
@gflpcantor31 thanks for reporting this. It didn't come up in any of my testing.
It's sort of an unfortunate state of things with dynamic SQL where at different times in different places string concatenation sometimes implicitly converts to lower byte lengths, causing these truncation errors. There's no great workaround for it other than to add a convert to nvarchar max around every string fragment, which is pretty tedious.
In the meantime, if you find which concatenation point in the dynamic SQL causes this, please let me know.
from darlingdata.
@gflpcantor31 can you try the version in the dev branch and let me know if that resolves the error for you?
from darlingdata.
Hello @erikdarlingdata
I've just tested the latest version, I'm sorry, but the error still occurs identically.
from darlingdata.
Hello @erikdarlingdata
To correct the error, I had to make the following two types of changes:
1 - Because of data type precedence (1) , I added the following:
@table_sql = CAST(N'' AS nvarchar(max)) +
....
....
2 - Again because of data type precedence and doubts about the data types returned by CASE expressions (?), as a precaution I applied a CAST to CASE expressions like this:
CAST ( CASE
WHEN ….
WHEN …
ELSE …. END AS nvarchar(max))
(1) Data type precedence https://learn.microsoft.com/en-us/sql/t-sql/data-types/data-type-precedence-transact-sql?view=sql-server-ver16
(2)
sp_HumanEvents__#273_gflpCantor31.zip
Maybe I've missed a few, but the only type 1/ change I made didn't resolve the error. That's why, to remove any doubts, I applied type 2/ modifications
Attached you'll find the script sp_HumanEvents__#273_gflpCantor31.zip where I've applied these modifications. With these modifications, I no longer reproduce the error. I'll leave it up to you to check and validate these modifications.
from darlingdata.
@gflpcantor31 If you open a proper pull request with these changes, I'm happy to take a look. It's a bit much to ask me to scroll through 3000 lines looking for your changes and then copying them over into my local file. Thanks!
from darlingdata.
Bonjour @erikdarlingdata
As desired, I've opened a pull request incorporating the changes.
I went back to your last CONVERT modifications (nvarchar(max), ..) and replaced them with a CAST, but only on the CASE expressions that caused the problem.
I've run a few tests. As far as I'm concerned, everything's OK and I don't see the error anymore.
I hope I haven't forgotten anything. I'm not very familiar with Git and Github procedures :)
from darlingdata.
Related Issues (20)
- Default retention period for tables created by sp_WhoIsActive Logging HOT 6
- sp_QuickieStore Issue on SQL Server 2022 Missing "sys." Schema when Querying query_store_plan_forcing_locations with AOAG
- sp_PressureDetector notes
- Divide by zero HOT 1
- Add the ability to return queries only from procedures/functions; Display summary resource usage data by procedure/function HOT 1
- sp_QuickieStore - Adjust for UTC Timestamps Used in Query Store HOT 4
- Make block viewer go faster
- Block Viewer plans
- Querying WhoIsActive-table returns an error in SSMS HOT 1
- Sorting sp_QuickieStore output by total CPU instead of average CPU HOT 1
- Notes from Canada HOT 1
- Syntax Error in the script HOT 1
- sp_HealthParser: Add xml deadlock report section
- sp_QuickieStore not returning expected runtime_stats records HOT 6
- sp_QuickieStore unexpected default @end_date HOT 4
- sp_QuickieStore - Count of executions across all plan ids? HOT 2
- sp_PressureDetector: configurable CPU percent details
- sp_HumanEventsBlockViewer: Add object schema to contentious object
- Given @days_back is always negative then this would always return @days_back HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from darlingdata.