Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truncation problem on wide tables #1

Open
hurcane opened this issue Jan 11, 2017 · 0 comments
Open

Truncation problem on wide tables #1

hurcane opened this issue Jan 11, 2017 · 0 comments

Comments

@hurcane
Copy link

hurcane commented Jan 11, 2017

If a table has many columns and lengthy column names, the generated select statement can be incomplete due to truncation . This leads to unpredictable errors or potentially invalid results. In my specific case, I was getting the following results:

PRINT 'Inserting values into [tblsaLocationMaster]'
Msg 105, Level 15, State 1, Line 1
Unclosed quotation mark after the character string 'Purchas'.
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'Purchas'.
PRINT 'Done'

Debug mode showed the last few characters of the generated select statement were:
+ REPLACE(RTRIM([Purchas

If the truncation occurred in just the right place, the symptom could be that the command succeeds, but some of the columns are not included in the output.

Changing the @Actual_Values variable from varchar(8000) to varchar(max) resolves the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant