I am trying to import pipe delimited data with BCP in SQL server but getting error. I have tried all the possible solution on the internet but couldn't get through.
Sample data -
1000004178|Valentin|FR12562062232|Valentin|Che St Georges| | |Alfortville|FR|2021-06-28 16:26:58|2021-06-28 16:26:58
1000007913|INDUSTRIAS MOLINERAS Y AFINES DEL NORTE S.A.C.I.A.|Z|INDUSTRIAS MOLINERAS Y AFINES DEL NORTE S.A.C.I.A.|Bv. Hipolito Yrigoyen|1648| |Reconquista|AR|2021-06-28 16:26:58.827|2021-06-28 16:26:58.827
1000011097|MARTINI RINALDO|MRTRLD46E16C139J|MARTINI RINALDO|VIA MASSIMO D' AZEGLIO 3| | |CERRO MAGGIORE|IT|2021-06-28 16:26:58.827|2021-06-28 16:26:58.827
1000017707|Energo stroj OOO||?????? ????? ???|??. ????????, ?. 18, ????. 2| | |??????|RU|2021-06-28 16:26:58.827|2021-06-28 16:26:58.827
Table schema -
CREATE TABLE dbo.sample(
[PartyID] [bigint] NOT NULL,
[Name] [nvarchar](255) NULL,
[VATNumber] [varchar](255) NULL,
[LegalName] [nvarchar](255) NULL,
[AddressLine1] [nvarchar](500) NULL,
[AddressLine2] [nvarchar](500) NULL,
[AddressLine3] [nvarchar](500) NULL,
[City] [nvarchar](100) NULL,
[Country] [nvarchar](100) NULL,
[CreatedDate] [datetime] NOT NULL,
[UpdatedDate] [datetime] NOT NULL
);
Enter the file storage type of field PartyID [bigint]: Enter prefix-length of field PartyID [0]: Enter field terminator [none]: |
Enter the file storage type of field Name [nvarchar]: Enter prefix-length of field Name [2]: 0 Enter length of field Name [510]: Enter field terminator [none]: |
Enter the file storage type of field VATNumber [char]: Enter prefix-length of field VATNumber [2]: 0 Enter length of field VATNumber [255]: Enter field terminator [none]: |
Enter the file storage type of field LegalName [nvarchar]: Enter prefix-length of field LegalName [2]: 0 Enter length of field LegalName [510]: Enter field terminator [none]: |
Enter the file storage type of field AddressLine1 [nvarchar]: Enter prefix-length of field AddressLine1 [2]: 0 Enter length of field AddressLine1 [1000]: Enter field terminator [none]: |
Enter the file storage type of field AddressLine2 [nvarchar]: Enter prefix-length of field AddressLine2 [2]: 0 Enter length of field AddressLine2 [1000]: Enter field terminator [none]: |
Enter the file storage type of field AddressLine3 [nvarchar]: Enter prefix-length of field AddressLine3 [2]: 0 Enter length of field AddressLine3 [1000]: Enter field terminator [none]: |
Enter the file storage type of field City [nvarchar]: Enter prefix-length of field City [2]: 0 Enter length of field City [200]: Enter field terminator [none]: |
Enter the file storage type of field Country [nvarchar]: Enter prefix-length of field Country [2]: 0 Enter length of field Country [200]: Enter field terminator [none]: |
Enter the file storage type of field CreatedDate [datetime]: Enter prefix-length of field CreatedDate [0]: Enter field terminator [none]: |
Enter the file storage type of field UpdatedDate [datetime]: Enter prefix-length of field UpdatedDate [0]: Enter field terminator [none]: \n
Do you want to save this format information in a file? [Y/n] n
Starting copy... SQLState = S1000, NativeError = 0 Error = [Microsoft][ODBC Driver 13 for SQL Server]Unexpected EOF encountered in BCP data-file
0 rows copied. Network packet size (bytes): 4096 Clock Time (ms.) Total : 1
The above is the code which I'm trying and not working.
bcp dbo.[sample] in C:\sample.txt -S <serverInstance> -U <username> -P <pwd>
trying the above bcp command.