How can we help you today?
Using EXEC in VistaDB to execute raw SQL Print
Modified on: Tue, Jul 22, 2014 at 12:22 AM
If you attempt to use EXEC in a SQL statement given to VistaDB, such as the following:
DECLARE @Test AS VARCHAR(100) SET @Test = 'SELECT * FROM Client'; EXEC(@Test);
It will fail with an error
error: expected expression, but found end of text
This usage of EXEC is not supported by VistaDB and isn't expected to be added. While we don't take likely ever saying "VistaDB isn't going to do this thing that SQL Server does" this just isn't a feature that VistaDB is ever going to support due to the nature of the design of the engine and the limited places where this is really a "best practice". There are cases in SQL Server where this is done (primarily to get around stored query plans, but that scenario doesn't apply to VistaDB) but even there it's advisable to consider it a last resort option.
Note that this doesn't apply to using EXEC to invoke a stored procedure within a SQL Statement which is supported.
Did you find it helpful? Yes NoSend feedback