Forum Discussion

Vrasackz's avatar
Vrasackz
Copper Contributor
Mar 14, 2024
Solved

Is it possible to query a database using azure client commands?

 

Hi guys,

 

I'm trying to query a record in my azure database record using azure client, I tried to use the commands below but both failed...

 

az sql database query --resource-group myresourcegroup --server-name myservername --database-name mydbname --query "SELECT * FROM dbo.x WHERE id = 'x'" --output table

 

'execute-command' is misspelled or not recognized by the system.

 

az sql db execute-command --resource-group myresourcegroup --server myservername --database mydbname --sql-query "SELECT * FROM dbo.x WHERE id = 'x'"

 

'execute' is misspelled or not recognized by the system.

 

does anyone know if its possible to query using azure client? the attempts above was suggestions by chatGPT and Gemini because I did not find anything on microsoft docs.

  • Hello Vrasackz 

     

    As you mentioned I didn't find these commands into the AZ CLI documentation, so I am not sure that you can proceed like this.

     

    Instead of AZ CLI, maybe you can consider to use https://learn.microsoft.com/en-us/sql/tools/sqlcmd/sqlcmd-utility?view=sql-server-ver16&tabs=go%2Cwindows&pivots=cs1-bash?

     

1 Reply

  • Hello Vrasackz 

     

    As you mentioned I didn't find these commands into the AZ CLI documentation, so I am not sure that you can proceed like this.

     

    Instead of AZ CLI, maybe you can consider to use https://learn.microsoft.com/en-us/sql/tools/sqlcmd/sqlcmd-utility?view=sql-server-ver16&tabs=go%2Cwindows&pivots=cs1-bash?