{"id":19485,"date":"2017-04-03T09:00:40","date_gmt":"2017-04-03T16:00:40","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/dataplatforminsider\/?p=19485"},"modified":"2024-01-22T22:50:47","modified_gmt":"2024-01-23T06:50:47","slug":"sql-server-command-line-tools-for-mac-preview-now-available","status":"publish","type":"post","link":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/04\/03\/sql-server-command-line-tools-for-mac-preview-now-available\/","title":{"rendered":"SQL Server Command Line Tools for Mac: Preview now available"},"content":{"rendered":"
This post was authored by Meet Bhagdev, Program Manager, Microsoft<\/em><\/p>\n We are excited to announce the availability of the preview for SQL Server Command Line Tools (sqlcmd and bcp) on Mac OS.<\/p>\n The sqlcmd utility<\/a> is a command-line tool that lets you submit T-SQL statements or batches to local and remote instances of SQL Server. The utility is extremely useful for repetitive database tasks such as batch processing or unit testing.<\/p>\n The bulk copy program utility (bcp)<\/a>, bulk copies data between an instance of Microsoft SQL Server and a data file in a user-specified format. The bcp utility can be used to import large numbers of new rows into SQL Server tables or to export data out of tables into data files.<\/p>\n \/usr\/bin\/ruby -e “$(curl -fsSL https:\/\/raw.githubusercontent.com\/Homebrew\/install\/master\/install)” SQLCMD<\/strong> BCP<\/strong> For more information, check out some examples for sqlcmd<\/a> and bcp<\/a>.<\/p>\n Please file bugs, questions or issues on our Issues <\/a>page. We welcome contributions, questions and issues of any kind.<\/p>\nInstall the tools for Mac El Capitan and Sierra<\/h2>\n
\nbrew tap microsoft\/mssql-preview https:\/\/github.com\/Microsoft\/homebrew-mssql-preview
\nbrew update
\nbrew install –no-sandbox msodbcsql mssql-tools
\n#for silent install ACCEPT_EULA=y brew install –no-sandbox msodbcsql mssql-tools<\/span><\/p>\nGet Started<\/h2>\n
\nsqlcmd -S localhost -U sa -P <your_password> -Q “<your_query>”<\/span><\/p>\n
\nbcp <your table>in ~\/test_data.txt -S localhost -U sa -P <your password>-d<your database> -c -t ‘,’<\/span>
\nbcp <your table>out ~\/test_export.txt -S localhost -U sa -P<your password> -d<your database> -c -t ‘,’<\/span><\/p>\n