Viewing 3 posts - 1 through 4 (of 4 total)
DECLARE @sql nvarchar(max);
DECLARE @FromDate char(8);
DECLARE @ToDate char(20);
DECLARE @PathFileName varchar(2000);
SET @FromDate = 20080101;
SET @ToDate = CONVERT(CHAR(20),GETDATE(),112);
SET @PathFileName = 'D:\SalesHis\SALES.'+@FromDate+'%''.txt';
WHILE (@ToDate > @FromDate)
SELECT @sql = 'BULK INSERT [SalesHis].[DBO].[Sales] FROM '+@PathFileName+'
WITH (FIELDTERMINATOR...
November 21, 2008 at 12:27 am
My Text File format is Sales.YYYYMMDDHHMMSS.txt
So my plan is running a query that can loop from 20080101 till today so i can import all the data to the database.
Please...
November 20, 2008 at 11:15 pm
Sorry, new error message come out.......
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'D'.
Msg 105, Level 15, State 1, Line 3
Unclosed quotation mark after the character string ')'.
Have...
November 20, 2008 at 10:57 pm
Viewing 3 posts - 1 through 4 (of 4 total)