Solution
This error can be produced due to various reasons, including an incorrect syntax or a truncation problem happening due to an underlying issue with the driver or provider being used to connect to the database.
- If you encounter this error when trying to write a long string, verify if the table field is set to a type that allows that length, for example varchar(max) data type allows for strings longer than 8000 bytes. Try manually creating a query in Microsoft SQL Server Management Studio to insert a string into the same table, if there's no error and the string is correctly inserted into the table the issue might be related to the driver or provider being used in LabVIEW. For example, when using the following connection string you can see this error when calling a stored procedure to insert a string of more than 8000 characters:
Driver=SQL Server; Server=ServerName; Database=DatabaseName; Trusted_Connection=True;
You can use the Microsoft OLE DB Provider for SQL Server instead to avoid this. The following connection string can be use when connecting to the database to avoid the error:
Provider=MSOLEDBSQL; Server=ServerName; Database=DatabaseName; Trusted_Connection=yes;