I’m working with soem code to find the product of two numbers in sql. I’m following this tutorial’s example. What I would like to know is, what is the correct syntax to use when a list of constants is used in a select statement’s FROM clause instead of a table name?
E.g.
SELECT EXP(SUM(LOG(num))) as product
FROM (VALUES (2),(3),(5),(7),(11),(13)) as NUMS(num)
This example keeps throwing the error
‘Incorrect syntax near the keyword ‘VALUES’.’
Again, I’m assuming this is possible, I’m just not sure what the correct syntax is. Thanks very much.
That syntax is valid for SQL Server 2008+. You must be running against an earlier version.
Try it as: