LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SQL database table column size limitation issue

Solved!
Go to solution

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. 

 

azadplc007_1-1579953345423.png

 

azadplc007_0-1579953859040.png

 

Regards,

Azad

 

0 Kudos
Message 1 of 4
(2,652 Views)

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. 😉

https://docs.microsoft.com/en-us/sql/sql-server/maximum-capacity-specifications-for-sql-server?view=...

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 4
(2,442 Views)
Solution
Accepted by topic author azadplc007

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..

azadplc007_0-1580190797756.png

 

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? 

0 Kudos
Message 3 of 4
(2,256 Views)

@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.

Using Labview 2022, Windows 10
0 Kudos
Message 4 of 4
(1,984 Views)