Jerald Baker
Jerald Baker

Reputation: 1359

Kusto KQL - Run multiple control commands at once

I want to run multiple command statements one after the other. For example, I create a table and then drop it :-

.create table MyLogs ( Level:string, Timestamp:datetime,Message:string);
.drop table MyLogs;

When I paste the above 2 lines in the Query tab and click on execute, I get a syntax error :


Syntax Error 

 A recognition error occurred. 
 Token: . 

 Line: 2, Position: 0

 clientRequestId: KustoWebV2;xxxxxxxxx

I have a .kql file that contains multiple control commands that must be executed one after the other - How can I do that?

Upvotes: 4

Views: 2079

Answers (1)

David דודו Markovitz
David דודו Markovitz

Reputation: 44941

.execute database script

.execute database script <|
.create table MyLogs (Level:string, Timestamp:datetime, Message:string)
.drop table MyLogs
OperationId CommandType CommandText Result Reason
a25a49a8-91b9-46c9-9ca9-adef76573642 TableCreate .create table MyLogs (Level:string, Timestamp:datetime, Message:string) Completed
e016fe3a-b655-4788-8ada-2b1a085bbd7d TableDrop .drop table MyLogs; Completed

Upvotes: 5

Related Questions