0
Problem
In some databases(SQLSERVER) I am often needing to popular the tables with some data, which usually comes from a file .txt
or .xlsx
, I need to do this as quickly as possible.
The first thing I thought about doing that would help me, was to copy the data from these files to excel, save them as .csv
and import into the bank banco de dados -> tarefas -> importar arquivo simples
, but this way the letters that come with accent are not recognized by SQLSERVER and are replaced by ?
.
The second thing I thought about doing was copying the data from the files .txt
or .xlsx
, go in tabela_do_banco -> Editar 200 linhas superiores
and paste there. In this way letters containing accent are recognized and displayed without
be replaced.
However, the problem in doing this second way is the following: after everything is ready I need to create the bank using the command sqlcmd -E -S .\sqlexpress -i "%CD%\script.sql"
and when I do this the data that were previously populated without any character being replaced are replaced :(.
Doubts
- Why SQLSERVER Express does not recognize accented words when creating bank using sqlcmd ?
- What could I do for SQLSERVER Express to recognize accents (á, à, ã, â, c) ?
I even installed the latest version of Sql Server 2019 and created the database with collate
Latin1_General_100_CI_AI_SC_UTF8
and the same thing happens: if I run the creation script of the bank and run it by the SSMS itself the bank is created normally without replacing the characters, but if I use the command of thesqlcmd
to execute the script file that contains the creation of the database; it creates the bank with the collate that I defined but replaces the characters that have accent by other strange.– Lone Tonberry