Sunday, March 25, 2012

Bulk Insert.

Is there any way I can use the following command like that ?
BULK INSERT Northwind.dbo.[Order Details]
FROM (select CSVTextFile from tblCSV)
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
Thanks in advance
The syntax of BULK INSERT is
quote:

BULK INSERT [ [ 'database_name'.] [ 'owner' ].] { 'table_name' FROM
'data_file' }...
'data_file'
Is the full path of the data file that contains data to copy into the
specified table or view. BULK INSERT can copy data from a disk (including
network, floppy disk, hard disk, and so on).
data_file must specify a valid path from the server on which SQL Server is
running. If data_file is a remote file, specify the Universal Naming
Convention (UNC) name.


Please refer to Books Online for examples of how to use BULK INSERT
http://msdn.microsoft.com/library/de...ba-bz_4fec.asp
Cristian Lefter, SQL Server MVP
MCT, MCSA, MCDBA, MCAD, MCSD .NET
"Rogers" <Rogers@.mailstuff.com> wrote in message
news:Oyx71bHuFHA.2624@.TK2MSFTNGP12.phx.gbl...
> Is there any way I can use the following command like that ?
> BULK INSERT Northwind.dbo.[Order Details]
> FROM (select CSVTextFile from tblCSV)
> WITH
> (
> FIELDTERMINATOR = ',',
> ROWTERMINATOR = '\n'
> )
> Thanks in advance
>
sql

No comments:

Post a Comment