stored procedure for importing txt in sql server db
Posted
by Iulian
on Stack Overflow
See other posts from Stack Overflow
or by Iulian
Published on 2010-05-13T10:26:53Z
Indexed on
2010/05/13
10:34 UTC
Read the original article
Hit count: 320
I have to insert new records in a database every day from a text file ( tab delimited). I'm trying to make this into a stored procedure with a parameter for the file to read data from.
CREATE PROCEDURE dbo.UpdateTable
@FilePath
BULK INSERT TMP_UPTable
FROM @FilePath
WITH
(
FIRSTROW = 2,
MAXERRORS = 0,
FIELDTERMINATOR = '\t',
ROWTERMINATOR = '\n'
)
RETURN
Then i would call this stored procedure from my code (C#) specifying the file to insert.
This is obviously not working, so how can i do it ?
© Stack Overflow or respective owner