You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The INFORMATION_SCHEMA.ROUTINES is merely a View cobbled together from a bunch of sys objects, where the ROUTINE_DEFINITION is parsed intonvarchar(4000).
This can be verified by looking up the INFORMATION_SCHEMA.ROUTINES definition with: SELECT OBJECT_DEFINITION(OBJECT_ID('INFORMATION_SCHEMA.ROUTINES'));. Snippet from the INFORMATION_SCHEMA.ROUTINES definition:
CREATEVIEWINFORMATION_SCHEMA.ROUTINES
ASSELECT-- ... view columns ...convert(nvarchar(4000),
OBJECT_DEFINITION(o.object_id)) AS ROUTINE_DEFINITION,
-- ... more view columns ...FROMsys.objects$ o LEFT JOINsys.parameters c
-- the rest of the definition
Or it could be fixed by mimicking the INFORMATION_SCHEMA.ROUTINES definition and using OBJECT_DEFINITION, but without any parsing to limited length string.
Notes:
The proposed fixes may not be compatible with older SQL versions (version pre-2005). link1, link2.
What:
Sqlectron truncating stored procedure code on SQL Server databases.
Why:
I did some digging through the Sqlectron front-end code, which pointed me to this DB Core repository.
The issue is where this query is getting its information from (lines 386-388) (see SO post):
sqlectron-db-core/src/adapters/sqlserver.ts
Lines 384 to 396 in 821da76
The
INFORMATION_SCHEMA.ROUTINES
is merely a View cobbled together from a bunch of sys objects, where theROUTINE_DEFINITION
is parsed intonvarchar(4000)
.This can be verified by looking up the
INFORMATION_SCHEMA.ROUTINES
definition with:SELECT OBJECT_DEFINITION(OBJECT_ID('INFORMATION_SCHEMA.ROUTINES'));
. Snippet from theINFORMATION_SCHEMA.ROUTINES
definition:Also see Microsoft's documentation [link].
Potential fix?
One of the ways to get full procedure code is:
Or it could be fixed by mimicking the
INFORMATION_SCHEMA.ROUTINES
definition and usingOBJECT_DEFINITION
, but without any parsing to limited length string.Notes:
The text was updated successfully, but these errors were encountered: