Number of columns in flat files vs number of columns in a table

0

AWS Redshift If the table to which I am going to copy the data from flat files, has different number of columns than the file, then do we get error? If not why?

Manoj
gefragt vor einem Jahr264 Aufrufe
1 Antwort
1

You will get an error if the table has more/fewer number of columns than the flat-file when using COPY command. If source file has fewer columns than the target table, add the keyword FILLRECORD to your copy statement to fill the additional columns in target table with NULL and load the data

AWS
beantwortet vor einem Jahr
  • Thanks @Anusha What is expected to happen in the other way? That is, when there are less columns in the table and more in the file? I am not getting error in that scenario. Please explain.

  • For flat files, you would get an error when there are extra fields. You can create those extra fields in the table to load the data.

  • Exactly! I should get an error here there are extra fields in the file. But I am not getting the error. Is there any parameter to set/unset? I would like to get an error when there are extra fields in the file.

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen