对自己实在无语,简单的一个union all问题
以下为一个存储过程,但是无论怎么写SQL语句,总是报错。
CREATE PROCEDURE 存储过程名
@变量1 nvarchar(40),
@变量2 nvarchar(20),
@变量3 nvarchar(20),
@变量4 nvarchar(6),
@变量5 nvarchar(6)
AS
BEGIN
select 新字段1,新字段2,新字段3
form (
select
11 as 新字段1
, 12 as 新字段2
, 13 as 新字段3
from 表1
union all select
21 as 新字段1
, 22 as 新字段2
, 23 as 新字段3
from 表2
) as tmp
END
CREATE PROCEDURE 存储过程名
@变量1 nvarchar(40),
@变量2 nvarchar(20),
@变量3 nvarchar(20),
@变量4 nvarchar(6),
@变量5 nvarchar(6)
AS
BEGIN
select 新字段1,新字段2,新字段3
from (
select
11 as 新字段1
, 12 as 新字段2
, 13 as 新字段3
from 表1
union all select
21 as 新字段1
, 22 as 新字段2
, 23 as 新字段3
from 表2
) as tmp
END