01-25-2020 05:59 AM - edited 01-25-2020 06:08 AM
Hi.
I'm trying to the write the values to SQL express DB from LabVIEW 2018.I am using String as a datatype for my DB table column. Since, I am using String datatype, I have to give the size of the column. My data contain nearly than 10000 characters. So, I given size of the column as 10000. But when I am trying the run this code I am getting the error. Refer pasted image below.
My question is, is there any column size limitation for the string datatype? If yes, how can I give more than 8k characters into one column.
Attached here Front Panel and Block Diagram of my code.
Regards,
Azad
Solved! Go to Solution.
01-27-2020 03:45 AM
The maximum for a string type is 8000, if you need longer you should use nvarchar. There might be an issue with maximum sql command length also, but that's the next problem. 😉
/Y
01-27-2020 11:57 PM
Thanks for reply.
Yes. It was limited with 8000 characters. If we are using nvarchar, this also limited by 4000 characters, I guess so.
But, there is way of increasing it, using Varchar(max). See below screenshot..
Above image, I used SQL query to create the table as per my requirement. It's worked fine.
Here my another point coming on my mind, How can we provide varchar(max) datatype from the LabVIEW itself instead of SQL query. In LabVIEW we have only six datatypes, isn't?
07-01-2020 12:16 PM
@azadplc007 wrote:
How can we provide varchar(max) datatype from the LabVIEW itself instead of SQL query. In LabVIEW we have only six datatypes, isn't?
Answer: You don't. You can create the table using the script you made in your previous post to set the SQL datatype of your column. When writing your data to SQL from Labview, SQL will attempt to 'fit' the input data type to its column. You can only send basic data types from LabView.
If you want, you can have LabView verify that your string length doesn't exceed SQL's Varchar(max) data type length.