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,
[...
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 ...
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)
...
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 >...
0
votes
1
answer
214
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
1
answer
248
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 ...
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
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 ...
0
votes
1
answer
211
views
Specific Effects of using nvarbinary vs nvarchar for storing images
I have seen the statement that if you are storing images in a column in a SQL Server database, you should use varbinary instead of nvarchar. Which makes 100% sense to store binary data as varbinary ...
0
votes
1
answer
119
views
Insert objects into database
I have ten thousand records in the postObj object and need to insert into a SQL Server database.
The object structure :
{
postObj : [
{
start_coordinates": {
&...
-4
votes
1
answer
751
views
Fix invalid datatype error, nvarchar is invalid [duplicate]
I have the query:
Select
Location, date, total_cases, total_deaths,
(total_deaths / total_cases) * 100 as DeathPercentage
From
PortfolioProject.dbo.CovidDeaths$
Order By
1, ...
0
votes
0
answers
166
views
NVARCHAR2 select where variable='€'
I have to use an old charset WE8ISO8859P1 (it a working environment, not sure why but I cannot change this) so I had to change my variable to NVARCHAR2.
Only problem when I try to filter based on the ...
-3
votes
1
answer
601
views
Can I use "/" operator on nvarchar column type in SQL Server Management Studio? [closed]
I am trying to divide 2 columns which are defined as nvarchar, but SSMS throws an error saying you can not use / operator on nvarchar.
select
location, date, total_cases, total_deaths,
(...
0
votes
0
answers
177
views
How to split NVARCHAR, converting the result into an int in SQL?
I'm trying to convert nvarchar separated with a comma to int, but I have a problem. I tried to use PARSENAME(REPLACE()), and it works fine but takes a long time to execute the code. I have a lot of ...
2
votes
0
answers
199
views
Converting nvarchar(255) in SQL Server to varchar in MariaDB?
I am using CData Sync to convert my table in SQL Server to MariaDB. The data type I have for some of my columns (including my primary key) is nvarchar(255) and when I try to convert it using CData ...
3
votes
1
answer
298
views
Why does SQL Server not behave consistently when dealing with half-emojis?
When an NVARCHAR attribute in a SQL Server database contains an emoji, string functions and operators behave in different ways (default database collation is SQL_Latin1_General_CP1_CI_AS).
Behavior of ...
-2
votes
1
answer
1k
views
Converting NVARCHAR to DECIMAL: All decimals lost
I am loading data from a CSV file to a staging table (using BULK INSERT) where all column types are NVARCHAR(100). This works well.
The idea is then to insert that data into the productive table and ...
0
votes
1
answer
689
views
SQL convert nvarchar into decimal dynamic rows
I am not so familiar with using convert in SQL so thats why i am stuck with the following situation:
The column has a nvarchar(max) and i would like to convert it into decimal (18,2). But there are ...
0
votes
0
answers
331
views
nvarchar vs varchar \ IN vs JOIN
Question regarding "IN" versus "INNER JOIN" and VARCHAR versus NVARCHAR
Examples lay it out...
This query returns the CORRECT results (11 count):
Uses nvarchar(10) data columns for ...
0
votes
1
answer
213
views
Get unique values from nvarchar datatype in SQL Server
I have a table in the SQL server database and it has a field with the type nvarchar. It stores the values in the format as shown below:
ROW 1 - ["value1", "value2", "...
0
votes
1
answer
559
views
Using CONVERT and extracting a week number
I'm trying to get a week number from "EndDate" column (nvarchar data type).
Convert function works fine below.
SELECT
EndDate,
CONVERT(DATE,EndDate,113) as "Date",
Output from ...
0
votes
1
answer
1k
views
From Varchar to Nvarchar with 'N' prefix
I have a table with thousands of rows. One of the columns does not read the values correctly. Some letters cannot be recognised and thus changed to some symbols like in the attached screenshot. I ...
1
vote
1
answer
2k
views
Why is a Variable declared as NVARCHAR(MAX) dropping chunks of the string?
For whatever reason, a query is being built as a string and passed off to be executed by another stored procedure.
The query is massive.
Over a thousand lines, and we've run into an issue that ...
0
votes
0
answers
115
views
Why nvarchar takes less storage than decimal in SQL Server?
A table has a nvarchar(12) column that stores MSISDNs (numbers only of a phone number). The size of the table is 9 Gb.
After changing the type of the column to decimal(12,0), the size of the table ...
1
vote
1
answer
1k
views
SQL Server Unicode character replacement
I'm trying to remove/replace certain unicode symbol characters from text in SQL Server 2019.
The server/DB I'm working with has collation Latin1_General_CI_AS.
I can't change the collation of the ...