question

ASHISHSINGH-6178 avatar image
0 Votes"
ASHISHSINGH-6178 asked SeeyaXi-msft commented

Run BCP command in sql server on linux

Hi, For my client I'm using below command to create txt file from SQL table.
**BCP "select from dbo.VW_RETAILER order by [ContractID] ASC, [PersdonID] ASC, [SKUID] ASC, [SequenceNo] ASC" queryout "E:\Project\Retailer.txt" -T -c -t "\t" -a 65535 -d Tools_XYZ -S SALES_SERVER*
Now Client want to use same command on their server but they are in the Linux environment.

Please assist how i can migrate this command in Linux OS !

sql-server-generalsql-server-transact-sql
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @ASHISHSINGH-6178 ,

We have not received a response from you. Did the reply could help you? If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. By doing so, it will benefit all community members who are having this similar issue. Your contribution is highly appreciated.

0 Votes 0 ·

Hi @ASHISHSINGH-6178

Just checking in to see if above information was helpful. If you have any further updates on this issue, please feel free to post back. If you think my reply is helpful to you, please remember to mark it as an answer. Warm thanks.

Best regards,
Seeya

0 Votes 0 ·
ErlandSommarskog avatar image
0 Votes"
ErlandSommarskog answered

That command line should work on Linux as well, I think. Well, you obviously need to change the file path, to one that is valid on the Linux machine.

And if integrated authentication is not working, you will need to replace -T with -U and -P for SQL authentication.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

SeeyaXi-msft avatar image
0 Votes"
SeeyaXi-msft answered

Hi @ASHISHSINGH-6178

See this docs about bcp Utility: https://docs.microsoft.com/en-us/sql/tools/bcp-utility?view=sql-server-ver15

For using bcp on Linux, see Install sqlcmd and bcp on Linux.

Best regards,
Seeya


If the response is helpful, please click "Accept Answer" and upvote it, as this could help other community members looking for similar queries.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.