Reputation: 11788
I have a stored function that generates an identity name based on a set of parameters like this:
.create function
with (docstring = 'Returns the table name for the specified data log provider.')
GetTableName(param1: string, param2: string)
{
// Some string cleansing and concatenation
let tableName = strcat(system, source);
tableName
}
I want to use this function to create a table. Tried the following options with no success:
.create table GetTableName('value1', 'value2') (Timestamp: datetime)
.create table [GetTableName('value1', 'value2')] (Timestamp: datetime)
I'm guessing the command expects the table name to be a string literal. Is there any way to accomplish this?
Upvotes: 0
Views: 131
Reputation: 3017
Control commands that create tables cannot include query execution (and vise versa: queries cannot run control commands). The restriction exists for security reasons.
You can achieve the scenario using client code and having two calls: 1) Derive table name 2) Generate table create command and send it to the server.
Upvotes: 1