HOw do I update the another field of table which is not effected by Bulk Insertion .

  • HI Friends

    We want to bulk insert into table table1

    Create table table1

    {

    ID,

    ProjectID,

    Fname

    }

    Create view VwName

    As

    (select Fname from table1)

    Create procedure prc_insert

    @ProjectID int

    As

    BEGIN

    BULK Insert vwName

    FROm 'D:\sample.txt'

    WITH

    (

    FIELDTERMINATOR = ',',

    ROWTERMINATOR = ''

    )

    END

    sample.txt content the comma separated Name of User.

    Once I execute the procedure 'prc_insert' it will Insert 'Fname' in table 'table1' ,

    How do insert/update ProjectID into table 'table1' , I want to pass same projectID in table for once executing the procedure .

    Thanks

    Please needful

  • Look at using openrowset and inserting into the table not the view passing in the parameter.

    INSERT INTO myTable(ProjectID,FName)

    SELECT @ProjectID, FName

    FROM OPENROWSET(BULK N'C:\Text1.txt', .....)

    GO

    http://msdn.microsoft.com/en-us/library/ms190312.aspx

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply