execute an update using --> "Exec sp_executesql @Sql1"
-
hi, i have a problem while executing updates using the update script inside the variable, it gives the error "String or binary data would be truncated"; I realized that if reduce the number of fields to update, it no longer gives the error! But I didn't want to divide the execution of the update into 2 variables!!! Can you help? Thanks!
-
hi, i have a problem while executing updates using the update script inside the variable, it gives the error "String or binary data would be truncated"; I realized that if reduce the number of fields to update, it no longer gives the error! But I didn't want to divide the execution of the update into 2 variables!!! Can you help? Thanks!
[https://stackoverflow.com/questions/5591473/error-string-or-binary-data-would-be-truncated-when-trying-to-insert\](https://stackoverflow.com/questions/5591473/error-string-or-binary-data-would-be-truncated-when-trying-to-insert) [String or binary data would be truncated - Google Search](https://www.google.com/search?q=String+or+binary+data+would+be+truncated&rlz=1C1CHBF\_enDE886DE886&sourceid=chrome&ie=UTF-8)
-
hi, i have a problem while executing updates using the update script inside the variable, it gives the error "String or binary data would be truncated"; I realized that if reduce the number of fields to update, it no longer gives the error! But I didn't want to divide the execution of the update into 2 variables!!! Can you help? Thanks!
How is the @Sql1 variable defined ? Ex: Declare @Sql1 Varchar(200)
-
hi, i have a problem while executing updates using the update script inside the variable, it gives the error "String or binary data would be truncated"; I realized that if reduce the number of fields to update, it no longer gives the error! But I didn't want to divide the execution of the update into 2 variables!!! Can you help? Thanks!
After thinking about this a bit more than required;
Member 11533892 wrote:
But I didn't want to divide the execution of the update into 2 variables!!!
You mean you don't want to execute two update-statements for the same record. Two variables cost nothing nowadays, so that doesn't make any sense. Two updates must be atomic, or you get concurrency issues. Could be simply solved by using a transaction. You may find the error to be the design of the table, not the update-statement. I'm going to guess a lot of those fields can be "NULL" or revert to some preset default value. ..but, let me give you a solution from a VB6 programmer view; you can rename all columns into numbers. So if column one is named [Name], you replace that with [1]. You can keep a list in Excel to look up the column names. That way, the update-statement is shorted a lot, and a huge lots of them would fit in a VARCHAR(MAX) command. :rolleyes:
Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.