492 questions
0 votes
1 answer
79 views
Nvarchar table column gets as varchar in view
I have the following table CREATE TABLE [OMEGACA].[ACC_POL] ( [POLICY_ID] [int] IDENTITY(1,1) NOT NULL, [POLICY_NAME] [nvarchar](200) NOT NULL, [POLICY_DESC] [nvarchar](1000) NULL, [...
2 votes
4 answers
120 views
Calculated, non-nullable, non-persisted nvarchar in SQL
Consider the following schema: CREATE TABLE [dbo].[User] ( [Id] BIGINT NOT NULL IDENTITY (1, 1), [NameGiven] NVARCHAR (256) NOT NULL, [...
0 votes
1 answer
112 views
What are the benefits of using the N prefix with VARCHAR instead of using NVARCHAR? [duplicate]
I can't find any resources that discuss this topic. I understand that NVARCHAR is used for non-English languages and takes up extra space, but why do some developers use a mix of the N prefix with the ...
1 vote
1 answer
451 views
A read operation on a large object failed while sending data to the client
I have a web API application that executes updates to a NVARCHAR(MAX) column and immediately after reads the result from the database. This usually works fine, but under high load it often fails with ...
0 votes
2 answers
80 views
Searching a text column for keywords very slow
I have a SQL Server database that only has a single table with a few columns. There are a few thousand rows currently. The columns are as follows: id (nvarchar(35)) path (nvarchar(255)) body (ntext) ...
0 votes
0 answers
82 views
XML path into temp table creates a nvarchar column, issues when merging it varchar column
I using SQL Server 2012 and need to use FOR XML PATH to get a comma-separated string for like projects. The query runs and works but when I try to alter #T2, I get an error String or binary data ...
1 vote
1 answer
117 views
Read huge nvarchar(max) as UTF-16 stream without saturate memory
I am developing a program that reads text from sql server nvarchar(max) field and needs to write it as UTF-16 text file inside a zip. I cannot load the string contained in the field as it weighs >...
1 vote
1 answer
158 views
Using nvarchar(max) in Azure stored procedure
We are testing moving from a local MSSQL db to Azure. We have an old ASP classic site which we need to maintain that creates an ADODB command to store email messages using a MSSQL stored procedure. ...
0 votes
1 answer
215 views
Why do commas take up two bytes?
select datalength(N','), unicode(N',') returns 2 in the first column and 44 in the second. This means that commas take up two bytes, but can be stored using just the number 44. , is in the first 128 ...
0 votes
0 answers
82 views
SSIS data conversion loses extended ASCII
I'm reading from a data source that returns unicode strings, and the output goes into a data conversion transform where I output a "string [DT_STR]" from it as my database is using varchar ...
0 votes
1 answer
254 views
If I call Left([col], x) on an NVARCHAR(max) column, is it always safe to save the output in an NVARCHAR(x) column?
The common misconception that the argument to NVARCHAR(x) is a character count has bitten me many times today. I am asking this question in the interest of exploring the topic further. Consider an ...
0 votes
1 answer
55 views
Procedure can't return large string response(~293 characters)
Below is my stored procedure create or replace PROCEDURE PR_GETECOUNT ( P_YEAR IN NUMBER ,P_RECORDSET OUT NVARCHAR2 ) AS l_r_count varchar2(400); l_v_count varchar2(400); l_e_count varchar2(400); ...
1 vote
2 answers
2k views
Updating nvarchar(max) in SQL Server with huge value
I'm trying to manually update a SQL Server column of type nvarchar(max) with a huge JSON parsed as text. It's a simple, straightforward query: UPDATE Books SET Story = '' WHERE Id = 23 The problem ...
0 votes
0 answers
25 views
JSON string in MS SQL Server is too large to select without CAST ing to XML [duplicate]
We have event data in a log table that is a JSON string of NVARCHAR(MAX) datatype. Some of the strings are too large to SELECT out of the table. But, if we CAST it, we can see the entire value. SELECT ...
0 votes
0 answers
91 views
Changing 8 column type of a big table from nvarchar(max) to varchar(x) with EF code Code-first
I have a very big table(T1) with a Tera byte of data in the Prod environment. There are some columns with nvarchar(max) which are such a miss. The table is created by code-first Ef core. Since it is ...