I am facing issue while importing the data in azure sql database using bcp utility.
bcp dbo.Account in "D:ABC\Account.csv" -S xxxxx.database.windows.net -U jfsa -P xxxxxx -d dbname -a 4096 -b 50000 -k -E -h "tablock" -q -c -l 120 -t "," -r "0x0d0x0a" -o "D:\Logs\FileLog\account_output.txt" -e "D:\Logs\Error\account_err.txt" -m 100 -F 2
Not getting any error but below message after running the command
Starting copy...
0 rows copied. Network packet size (bytes): 4096 Clock Time (ms.) Total : 1

You can use SQL server management studio to load the csv file to sql database. Follow the steps in this document How to import a CSV file into a database using SQL Server Management Studio-discountasp.net.
You can also use Copy activity in azure data factory to copy csv data into sql database. Give csv file as source dataset and SQL database table as a sink dataset in copy activity.
As @Dai suggested, you can also use c# with the use of
CsvHelperNuGet library to fill aSystem.Data.DataTablewhich is passed intoSqlBulkCopy. I used that approach as you can see below.Below are the steps I followed:
Connection String is used to connect with Azure SQL Database. tableName and csvFilePath is used to store the Table name and .csv file path.
StreamReaderis created to read the CSV file andCsvHelperis used to parse the csv data.Each record in the CSV is an instance of DataClass. The
ToList()method is used to read all records from the CSV.DataTablenameddtis created to match the structure of the SQL table. It is configured with columns according to the structure of the data.SqlBulkCopyis used to insert the data from theDataTableinto the Azure SQL Database.Below Is the code I tried with:
Data Stored in CSV file:
Output: