Home Forums SQL Server 2005 T-SQL (SS2K5) xp_cmdshell - Procedure expects parameter 'command_string' of type 'varchar' RE: xp_cmdshell - Procedure expects parameter 'command_string' of type 'varchar'

  • riswana (11/1/2012)


    Hi,

    I am having the same problem. My query string is greater than 8000 characters. I am using varchar(max).

    Can someone assist urgently with a result, please.

    On computers running Microsoft Windows XP or later, the maximum length of the string that you can use at the command prompt is 8191 characters.

    so you need to shorten up whatever is being passed as a query to your bcp.

    use the query string to insert the data into a view, and use bcp to select from the view instead.

    see this very similar post, where the Original poster needed to change his bcp query to select from a view(or global temp table):

    http://www.sqlservercentral.com/Forums/FindPost1378950.aspx

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!