SOLVED

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

Copper Contributor

 

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.

1 Reply
best response confirmed by Vrasackz (Copper Contributor)
Solution

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 sqlcmd?

 
1 best response

Accepted Solutions
best response confirmed by Vrasackz (Copper Contributor)
Solution

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 sqlcmd?

 

View solution in original post