I have this query:
BULK INSERT Employee
FROM 'E:\\file.txt' --location with filename
WITH
(
FIELDTERMINATOR = ' ',
ROWTERMINATOR = '\n'
)
GO
And in the my file, the data looks like this:
43266200 6827 43295200 1393/05/23 14:26:26 18 1
I want insert this data into my table, but in file in the my fieldterminator have a error and SQL Server complains about space or tab between fields error. How can I solve this?
can i use this?
BULK INSERT Employee
FROM 'E:\\file.txt' --location with filename
WITH
(
FIELDTERMINATOR = ' ' or ' ' or ' ',
ROWTERMINATOR = '\n'
)
GO
or how can i import this txt file into sql server?
FROM 'E:\\file.txt'Is this the actual SQL you're running or are you trying to extract it from your C# source code, sans"? Because it looks like the latter. In which case, pay attention to the actual SQL statement being run.