'sqlcmd to insert from csv into sql table

How can I use sqlcmd to insert data from a csv file into an existing SQL table? The below command is not working.

sqlcmd -S <servername> -U <username> -P <password> -d <dbname> -i c:\test.csv -s "|" -o "dbo.sqltable"

I cannot use Bulk import or the Import wizard on SSMS.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source