我试过了:
INSERT INTO tbl_vaucher
(
vaucher_name,
created_date
)
VALUES (
( SELECT TOP 1
con_full_name
FROM tbl_contact
),
GETDATE()
)
,获得:Subqueries are not allowed in this context. Only scalar expressions are allowed
。
我需要一个没有功能的解决方案。
答案 0 :(得分:22)
INSERT
INTO tbl_vaucher (vaucher_name, created_date)
SELECT TOP 1
con_full_name, GETDATE()
FROM tbl_contact