SQL Server equivalent query for the given mysql query

bcp sqlbulkcopy sql-server

Question

Table name : sample

Table structure :

ID         int
NAME       varchar(30)
IPADDRESS  varbinary(16) 

mysql query :

load data concurrent local infile 'C:\test.txt' into table sample fields terminated by ',' LINES TERMINATED BY '\r\n' (ID,NAME,@var3) set IPADDRESS = inet_pton(@var3)

SQL Server equivalent query :

?? 

using bcp will be appreciated.. Thanks in advance..

Popular Answer

Here is an article which you will find useful:

How do I load text or csv file data into SQL Server?

It was the second result from Google when searching for "bcp load file"

EDIT:

You might be able to do your import in two steps. Load the rows from the file in to a temp table then apply a function to convert the IP strings to the binary format.

Have a look at this question on SO: Datatype for storing ip address in SQL Server



Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why