SQL Server & Node.js REST API – Problem Solved – How send in parameters massive string datas longer then 2000 characters – error “Invalid precision value”

In case of SQL Server & Node.js Rest Api (when we use SQL Native Driver 10 or 11) when we try to send as parameter huge string that counting more then 2000 characters during DB CRUD operations we have got the error “Invalid precision value” – that means that length of string of our parameter exceed 2000 characters. This error doesn’t comes from SQL Server but from SQL Native Driver.  Question is: How we can send massive string data or XML? Is it possible? Yes, it is. To solve this problem we have to perform a few modifications both in Node.js Server and SQL Server side. MUST TO HAVE:

  1. SQL Server Side: in case of tables or stored procedures we have to use NVARCHAR(MAX). When we want to use xml in stored procedure side we can perform conversion: CONVERT(XML, input_param)
  2. Node.js:  in case of parameter (Both massive string or XML) before sending to DB we have to use function:

In case of string:

const param1 = mssql.WLongVarChar(categories);

In case of xml:

const param1 = mssql.WLongVarChar(categories_xml);
August 15th, 2016

  • I precisely had to say thanks once more. I do not know the things that I would have accomplished in the absence of the actual suggestions documented by you concerning this topic. Completely was the daunting situation for me personally, but taking note of a new specialised technique you resolved it took me to cry with contentment. I’m happier for the advice and pray you are aware of a great job you happen to be providing teaching many others through the use of your blog. I am sure you’ve never got to know any of us..

  • I actually wanted to write down a brief comment so as to appreciate you for the precious recommendations you are placing here. My time consuming internet research has at the end been rewarded with useful ideas to share with my company. I would state that that most of us website visitors actually are rather blessed to be in a very good site with very many outstanding professionals with good things. I feel quite lucky to have come across your entire web page and look forward to really more cool times reading here. Thanks once more for everything..

  • You made some first rate points there. I appeared on the internet for the difficulty and found most individuals will associate with along with your website..

  • You made some first rate factors there. I looked on the internet for the difficulty and found most individuals will associate with along with your website..

  • Thanks a lot for providing individuals with an extraordinarily breathtaking chance to read articles and blog posts from here. It’s always very fantastic and jam-packed with a lot of fun for me and my office peers to visit your site nearly three times in one week to read the newest secrets you have got. And lastly, we are at all times pleased for the dazzling advice you give. Some two ideas on this page are certainly the most impressive we have all had..

  • Youre so cool! I dont suppose Ive read something like this before. So good to search out anyone with some original ideas on this subject. realy thank you for beginning this up. this website is one thing that’s needed on the internet, someone with a bit originality. helpful job for bringing one thing new to the internet!.

  • After study a few of the blog posts in your website now, and I actually like your way of blogging. I bookmarked it to my bookmark website record and will likely be checking back soon. Pls try my website online as nicely and let me know what you think..