For the provided mysql query, there is a SQL Server similar 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..

1
0
1/20/2011 10:05:24 AM

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

0
5/23/2017 11:55:28 AM


Related Questions





Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow