Open cfsamson opened 1 year ago
Temporary workaround:
If you know the max size of the data you work with you can change the SQL to:
SELECT CAST(col1 AS NVARCHAR(1024)) as col1 FROM test.dbo.test
Change the size to whatever size you want (it doesn't seem to matter just as long as there is an explicit size set).
Can confirm this. Can reproduce with docker image using default config:
docker run --rm -it -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=@Passw0rd" -p 1433:1433 mcr.microsoft.com/mssql/server:2022-latest
Also affects VARCHAR type.
Duplicate issues: #2286, #1838
I fixed multiple bugs related to string handling in mssql in https://github.com/lovasoa/sqlx
@lovasoa Great, I'll use that going forward 👍👍👍
Bug Description
NVARCHAR(MAX) doesn't parse correctly on Sql Server Express 16.0.1000.6.
On Sql Server 2016 version 12.0.6169.19 it simply panics with the error:
Minimal Reproduction
Assuming you have a local Mssql Express server running (quick setup guide if you don't):
Sql Server Configuration Manager (Sql Server Network Configuration -> Protocols for SQLEXPRESS -> TCP/IP -> right click "enable"
On local sql server called "testserver" with a user test, pwd: test and port: 60000
Setup project:
Run
cargo run
and you get the output:Expected:
On sql server 2016 this just panics.
Info
rustc --version
: 1.65.0