Results 1 to 4 of 4

Thread: BCP error

  1. #1
    Join Date
    Sep 2004
    Posts
    30

    Unanswered: BCP error

    Hi,
    Env: win2k, mssql 8.00.194, Standard Edition

    Please help me to make the following bcp to work.
    I want to save RS from store procedure to ascii file, using BCP. The sp creates temporary tables and the final select in sp is ‘exec sp_executesql @comm’.
    The following example demonstrates the problem:

    declare @bcpCommand nvarchar(100)
    set @bcpCommand = 'bcp "exec sp_helpdb" queryout "\\kkkk\bcp_dbs.log" -c'
    exec master..xp_cmdshell @bcpCommand

    I'm getting the following error:
    Password:
    SQLState = S1000, NativeError = 0
    Error = [Microsoft][ODBC SQL Server Driver]BCP host-files must contain at least one column
    NULL

    Thanks

  2. #2
    Join Date
    Oct 2001
    Location
    England
    Posts
    426
    declare @bcpCommand nvarchar(100)
    set @bcpCommand = 'bcp "set fmtonly off exec sp_helpdb" queryout "c:\test.txt" -c'
    exec master..xp_cmdshell @bcpCommand

  3. #3
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Damn...who was that (un)masked man????

    Very nice....but it's as clear as mud

    BOL

    Returns only meta data to the client.

    Syntax
    SET FMTONLY { ON | OFF }

    Remarks
    No rows are processed or sent to the client as a result of the request when SET FMTONLY is turned ON.

    The setting of SET FMTONLY is set at execute or run time and not at parse time.

    Permissions
    SET FMTONLY permissions default to all users.

    Examples
    This example changes the SET FMTONLY setting to ON and executes a SELECT statement. The setting causes the statement to return the column information only; no rows of data are returned.

    SET FMTONLY ON
    GO
    USE pubs
    GO
    SELECT *
    FROM pubs.dbo.authors
    GO
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  4. #4
    Join Date
    Sep 2004
    Posts
    30
    Thanks for the replay - it works .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •