Home -
General /
All posts - RENAME TABLE does not parse stored values
|
There might be a good reason for this not being possible. In RENAME TABLE [old] [new], neither [old] nor [new] can be replaced by a stored VALUE (whether NVARCHAR or TABLE) nor e.g. by PragmaValue('creatednamequoted'). It would be convenient if it were possible, or if there were some other way to synthesize table names (I really mean table references) from strings.
|
|
We don't currently allow composing component / schema item names from expressions. Mostly not because we cannot do so - we can, our SQL statements are dynamic enough for component / field / index / constraint names to be determined at runtime - but rather because the syntax seems a little too permitting, maybe we should restrict it in some way. We are fine with just: --SQL9 RENAME TABLE @a @b; ...but less fine with: --SQL9 RENAME TABLE 'name' 'my' + @value + currentDate() + askUserForPostfix('hi'); ...because it is very unclear from the above that the old name is 'name' and the rest is the new name, the space that separates the old name from the new name just gets lost in the noise. Maybe we should have a construct like RENAME TABLE $(...), probably with something other than $, which would indicate that in this particular place we are composing an identifier from an expression.
|