We are using a web service that has decided to change the maximum field length from 255. We have an outdated vendor table at our end, which is still limited to 255. We hope to use a trigger to solve this problem temporarily until we can implement more a business-friendly solution in our next iteration.
Here is what I started with:
CREATE TRIGGER [mySchema].[TruncDescription]
ON [mySchema].[myTable]
INSTEAD OF INSERT
AS
BEGIN
SET NOCOUNT ON;
INSERT INTO [mySchema].[myTable]
SELECT SubType, type, substring(description, 1, 255)
FROM inserted
END
However, when I try to paste on myTable, I get an error:
String or binary data will be truncated. The application was discontinued.
I tried to experiment with SET ANSI_WARNINGS OFF, which allowed the request to work, but then just did not insert any data into the description column.
, , ? (.. ), , -, , . .