Questions about exporting and importing flatfiles (txt, csv) in SQL Server 2005

  • What is the best separator to use when exporting data?
  • What is the best way to work with NULL data if you have an INT field in a table?
+3
source share
3 answers

I'm not sure what I'm trying to ask for (wonderful name: JPnoui38f). Sql Server management Studio allows you to write data in several ways. You do not need to worry about how to handle zeros or which demir to use. Tools will take care of this.

Here's an article about the Import / Export Wizard . Another option is a database publishing wizard that uploads your data to sql scripts.

+3
source

, bcp -c ( ) , , . bcp, .

MSSQL, xp_cmdshell, - . , .

:

  • - , .
  • ,

- , .

+1
  • If you have data with built-in that you may want to do export based on the prefix, using bcp instead of separator text. prefix adds a column with a length indicator and the import reads this, rather than looking for a delimiter.

  • For some reason I cannot understand and cannot find the documentation, bcp will not import null values ​​into numeric columns, even if they are nullable. You need to make a dining table with all the columns and then data.

0
source

Source: https://habr.com/ru/post/1697978/


All Articles