sql 有子句问题的服务器
sql server with clause issue
sql 低于 运行s 在 db2
中没有问题
with mytable(a,b) as (
values(
(select current timestamp from sysibm.sysdummy1), (select current timestamp from sysibm.sysdummy1))
)
select * from mytable
我想在 sql 服务器中 运行 类似的东西,当我给这个
with mytable(a,b) as (
values(
(select current_timestamp), (select current_timestamp))
)
select * from mytable
出现以下错误:
Error: Incorrect syntax near the keyword 'values'. SQLState: S1000 ErrorCode: 156 Error: Incorrect syntax near ','. SQLState: 42000
ErrorCode: 102 Error: Incorrect syntax near ')'. SQLState: 42000
ErrorCode: 102
有什么想法吗?
你可以省略 values
:
with mytable(a, b) as (
select current_timestamp, current_timestamp
)
select *
from mytable;
sql 低于 运行s 在 db2
中没有问题with mytable(a,b) as (
values(
(select current timestamp from sysibm.sysdummy1), (select current timestamp from sysibm.sysdummy1))
)
select * from mytable
我想在 sql 服务器中 运行 类似的东西,当我给这个
with mytable(a,b) as (
values(
(select current_timestamp), (select current_timestamp))
)
select * from mytable
出现以下错误:
Error: Incorrect syntax near the keyword 'values'. SQLState: S1000 ErrorCode: 156 Error: Incorrect syntax near ','. SQLState: 42000 ErrorCode: 102 Error: Incorrect syntax near ')'. SQLState: 42000 ErrorCode: 102
有什么想法吗?
你可以省略 values
:
with mytable(a, b) as (
select current_timestamp, current_timestamp
)
select *
from mytable;