2

I know it is possible to create a database server and database in azure by using cli without using azure portal. But is that also possible to create a table in azure database from cmd by using cli?

The goal is to script everything.

Shayki Abramczyk
  • 36,824
  • 16
  • 89
  • 114
milan-W
  • 65
  • 1
  • 9

1 Answers1

0

You can connect to Azure SQL Database using the sqlcmd command line tool. There's even a Linux version.

CSharpRocks
  • 6,791
  • 1
  • 21
  • 27
  • I never used sqlcmd before and I dont know how it works. Any way I tried to run the command sqlcmd but I got this error : – milan-W Mar 09 '19 at 13:12
  • "Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Named Pipes Provider: Could not open a connection to SQL Server [2]. . Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Login timeout expired. Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online." – milan-W Mar 09 '19 at 13:13
  • 1
    Run a script against SQL DB would look something like this `PS C:\temp> sqlcmd -S xxxxxx.database.windows.net -d AdventureWorks -U xxxxxx -P xxxxxx -i foo.sql` – David Browne - Microsoft Mar 11 '19 at 17:31