SQLState = 28000, NativeError = 18456 Error = [Microsoft][SQL Native Client][SQL Server]Login failed for user 'sa'.

  • when i run the below query (BCP command with xp_cmdsehll in query anlyzer )

    exec xp_cmdshell 'BCP "select SCHEDULE.SID ,Delivery.DeliverId,DELIVERYITEM.DPID ,DELIVERYITEM.DPQty FROM dg.dbo.T_SCHEDULE SCHEDULE INNER JOIN dg.dbo.T_Delivery Delivery ON(Delivery.DFSID = SCHEDULE.SID) INNER JOIN dg.dbo.T_DeliveryITEM DELIVERYITEM ON (DELIVERYITEM.DPFDID = Delivery.DID ) FOR XML AUTO,ELEMENTS " QUERYOUT "D:\TEST.xml" -c -t -S"DSK07" -U"sa" -P"sa")'

    i got error :

    SQLState = 28000, NativeError = 18456 Error = [Microsoft][SQL Native Client][SQL Server]Login failed for user 'sa'.

    when i run above query in cmd command (BCP command in command promt)

    like

    c:\'BCP "select SCHEDULE.SID ,Delivery.DeliverId,DELIVERYITEM.DPID ,DELIVERYITEM.DPQty FROM dg.dbo.T_SCHEDULE SCHEDULE INNER JOIN dg.dbo.T_Delivery Delivery ON(Delivery.DFSID = SCHEDULE.SID) INNER JOIN dg.dbo.T_DeliveryITEM DELIVERYITEM ON (DELIVERYITEM.DPFDID = Delivery.DID ) FOR XML AUTO,ELEMENTS " QUERYOUT "D:\TEST.xml" -c -t -S"DSK07" -U"sa" -P"sa")

    it run sucessfully..

    Can sove this issue anyone?

    _____________________________________________________________________________________________________________
    Paresh Prajapati
    ➡ +919924626601
    http://paresh-sqldba.blogspot.com/[/url]
    LinkedIn | Tweet Me | FaceBook | Brijj

  • Per http://msdn.microsoft.com/en-us/library/ms175046.aspx you can only have a single set of quotes in an xp_cmdshell. Have you tried removing superfluous quotes?



    Shamless self promotion - read my blog http://sirsql.net

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

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