bcp

  • Hi All,

    I have a table mbt_image_1MB.

    create table mbt_image_1MB

       (emp_id int identity(1,1) not null,

        fname varchar(20) null,

        lname varchar(30) null,

        hiredate datetime null,

        ssn char(12) null,

        mgrid int null,

        dept varchar(20) null,

        title char(30) null,

        hourly_wage money not null default $5.00,

        employee_image image not null)

    go

    -- I insert a few bulk insert statements.

    bulk insert dbo.mbt_image_1MB from '\\pund2k215\mbt\sql\image_data\1MB.bmp'

    with (formatfile = '\\pund2k215\mbt\sql\image_data\mbt_image_bcp_format10.txt')

    go

    bulk insert dbo.mbt_image_1MB from '\\pund2k215\mbt\sql\image_data\1MB.bmp'

    with (formatfile = '\\pund2k215\mbt\sql\image_data\mbt_image_bcp_format10.txt')

    go

    bulk insert dbo.mbt_image_1MB from '\\pund2k215\mbt\sql\image_data\1MB.bmp'

    with (formatfile = '\\pund2k215\mbt\sql\image_data\mbt_image_bcp_format10.txt')

    go

    bulk insert dbo.mbt_image_1MB from '\\pund2k215\mbt\sql\image_data\1MB.bmp'

    with (formatfile = '\\pund2k215\mbt\sql\image_data\mbt_image_bcp_format10.txt')

    go

    bulk insert dbo.mbt_image_1MB from '\\pund2k215\mbt\sql\image_data\1MB.bmp'

    with (formatfile = '\\pund2k215\mbt\sql\image_data\mbt_image_bcp_format10.txt')

    go

    bulk insert dbo.mbt_image_1MB from '\\pund2k215\mbt\sql\image_data\1MB.bmp'

    with (formatfile = '\\pund2k215\mbt\sql\image_data\mbt_image_bcp_format10.txt')

    go

    bulk insert dbo.mbt_image_1MB from '\\pund2k215\mbt\sql\image_data\1MB.bmp'

    with (formatfile = '\\pund2k215\mbt\sql\image_data\mbt_image_bcp_format10.txt')

    go

    bulk insert dbo.mbt_image_1MB from '\\pund2k215\mbt\sql\image_data\1MB.bmp'

    with (formatfile = '\\pund2k215\mbt\sql\image_data\mbt_image_bcp_format10.txt')

    go

    bulk insert dbo.mbt_image_1MB from '\\pund2k215\mbt\sql\image_data\1MB.bmp'

    with (formatfile = '\\pund2k215\mbt\sql\image_data\mbt_image_bcp_format10.txt')

    go

    bulk insert dbo.mbt_image_1MB from '\\pund2k215\mbt\sql\image_data\1MB.bmp'

    with (formatfile = '\\pund2k215\mbt\sql\image_data\mbt_image_bcp_format10.txt')

    go

    Now I am trying to create a format file using the bcp utitlity.

    bcp [TESTDB].[DBO].{mbt_image_1MB} {in} [c:\new_auth.dat] [-fc:\authors.fmt] [-Spund2k215[\sql2ka]] [-Usa] [-Ppund2k215]

    I am getting the error :

    [Microsoft][ODBC SQL Server Driver]Syntax error or access violation

    Pls. help.

    Thnks,

    Kishore

  • bcp [TESTDB].[DBO].{mbt_image_1MB} {in} [c:\new_auth.dat] [-fc:\authors.fmt] [-Spund2k215[\sql2ka]] [-Usa] [-Ppund2k215]

     

    Are you trying to do this in Query Anaylzer or Command Prompt, should be done using a command prompt window. And should read like so

     

    bcp "TESTDB.DBO.mbt_image_1MB" in "c:\new_auth.dat" -f "c:\authors.fmt" -S "pund2k215\sql2ka" -U "sa" -P "pund2k215"

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

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