Comments (6)
I use sql.NVarChar('max')
without issue
from node-mssql.
According to SQL server error messages, MAX length is not supported in prepared statements.
The size (65535) given to the type 'varchar' exceeds the maximum allowed for any data type (8000).
The size (65535) given to the type 'nvarchar' exceeds the maximum allowed for any data type (8000).
The size (65535) given to the type 'varbinary' exceeds the maximum allowed for any data type (8000).
@rossipedia, you should not use sql.NVarChar('max')
, it only create NVARCHAR(4000)
, you should use sql.NVarChar(sql.MAX)
.
from node-mssql.
My mistake, it was a bug in type declaration. It's fixed now.
from node-mssql.
@patriksimek thanks for the tip! we've since moved to matching parameter types to the columns, but that's good to know for future reference
from node-mssql.
Not sure if it's this exact bug, but I'm having a problem related to this - using SQL Server 2012 and node-mssql 1.3.0. I'm trying to pass empty string to a prepared statement using sql.NVarChar(sql.MAX)
and it fails on execute()
Expected result: [ { MyString: '' } ]
Actual result: execute() failed
Problem only seems occur with the magical combination of sql.MAX
and str === ''
. As long as there is at least 1 character in the string, or if I use sql.NVarChar(4000)
it works as expected.
var ps = new sql.PreparedStatement(connection);
ps.input('str', sql.NVarChar(sql.MAX));
ps.prepare('SELECT @str AS MyString', function (err) {
if (err) {
console.log('prepare() failed');
}
ps.execute({
str: ''
}, function (err, recordset) {
if (err) {
console.log('execute() failed');
}
console.dir(recordset);
});
});
from node-mssql.
Thanks for the report, it's fixed and will be part of the 2.0 release.
from node-mssql.
Related Issues (20)
- Committing a transaction early, within a transaction ? HOT 4
- [Question] Does node-mssql support Kerberos authentication HOT 1
- ConnectionError: Connection not yet open. HOT 1
- How to bind a multidimensional array HOT 3
- How to add order by from user input? HOT 1
- (node:1009) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 error listeners added to [ConnectionPool]. Use emitter.setMaxListeners() to increase limit HOT 1
- Bulk Insert Time Out HOT 1
- Bulk upload with a DateTime2 column HOT 3
- error self signed certificate - Lambda function Nodejs connect to mssql on ec2 instance after migrating from 6.2.0 to 10.0.2 HOT 6
- node-mssql only works if TCP/IP for SQL Server is turned on HOT 3
- mssql suddenly stopped working with INSERTS to sql server db from AWS Lambda, with no changes anywhere. Had been working fine for years. HOT 1
- error:0A000102 when linking to database HOT 1
- Update Tedious to 18.2.1 to resolve Azure Identity vulnerabilities HOT 5
- Query execution takes more than 30 seconds using Tedious while same query using Microsoft JDBC Driver for SQL Server on DBeaver takes only 200 ms HOT 3
- mssql@v10 dropped support for Node v14 partially HOT 1
- Enable GitHub Discussions HOT 2
- Does msnodesqlv8 driver support Azure Managed Identity authentication mode HOT 1
- `CREATE DATABASE` Failing When Using the ES6 Tagged Template Literal Approach HOT 1
- Would there be memory leaks if we create a new new sql.ConnectionPool with each query and then call .close() to close all connections in the pool after the query? HOT 1
- FailureException: recvmsg EINVALStack: ConnectionError: recvmsg EINVAL - EINSTLOOKUP fails in Azure ASE v3 environment HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-mssql.