Whats wrong with this SQL statement for table variable bulk insert

后端 未结 4 834
挽巷
挽巷 2020-12-10 14:25

I\'m trying to insert a CSV into a Temporary table and this SQL statement doesn\'t seem to work.

DECLARE @TempTable TABLE (FName nvarchar(max),SName nvarchar         


        
4条回答
  •  佛祖请我去吃肉
    2020-12-10 14:51

    you can not use bulk insert for table variable. for that you have create temp table like below.

    CREATE TABLE #TEMPtbl 
    (
        [FNAME] [nvarchar](MAX) ,
        [SNAME] [nvarchar](MAX) ,
        [EMAIL] [nvarchar](MAX) 
    )
    GO 
    BULK INSERT #TEMPtbl FROM 'C:\FileName.csv' 
    WITH (FIRSTROW = 1, FIELDTERMINATOR = ',', ROWTERMINATOR = '\n')
    

    you can try This one. it may be help you.

提交回复
热议问题