插入的时候报AS附近语法错误
--CREATE PROCEDURE PROC_SetRouitngInfo
DECLARE @FeederRoutingID UNIQUEIDENTIFIER
DECLARE @ContractID UNIQUEIDENTIFIER
DECLARE @OnlineRoutingID UNIQUEIDENTIFIER
DECLARE @InterlineRoutingID UNIQUEIDENTIFIER
DECLARE @FeederFareID UNIQUEIDENTIFIER
DECLARE @InterlineFareID UNIQUEIDENTIFIER
DECLARE @OnlineFareID UNIQUEIDENTIFIER
DECLARE @DateFrom DATETIME
DECLARE @DateTo DATETIME
DECLARE @IsRoundTrip TINYINT
DECLARE @Airline NVARCHAR(100)
BEGIN
-- 判断@FeederDep和@Destination是否是zone和Airport
-- 1,@FeederDep和@Destination同时为zone
IF charindex( '_ ',@FeederDep)> 0 AND charindex( '_ ',@Destination)> 0
BEGIN
EXEC (
'SELECT t1.a as Departure,t2.a as Destination, '+
@FeederRoutingID + ', ' +
@OnlineRoutingID+ ', ' +
@InterlineRoutingID+ ', ' +
@FeederFareID+ ', ' +
@OnlineFareID+ ', ' +
@InterlineFareID+ ', ' +
@ContractID+ ', ' +
@DateFrom+ ', ' +
@DateTo+ ', ' +
@IsRoundTrip+ ', '+
@Airline + ' INTO ' + @Airline +
'FROM
(
select airportcode As a from
(select * from zone where zoneNo= ' ' ' + @FeederDep + ' ' ')Z
INNER JOIN ZoneElement ZE ON Z.zoneID=ZE.zoneID
INNER JOIN MST_AirPort A ON A.AirPortID=ZE.AirPortID
) AS t1
CROSS JOIN
( select airportcode As a from
(select * from zone where zoneNo= ' ' ' + @Destination + ' ' ')Z
INNER JOIN ZoneElement ZE ON Z.zoneID=ZE.zoneID
INNER JOIN MST_AirPort A ON A.AirPortID=ZE.AirPortID
) AS t2
ORDER BY Departure,Destination ')
END
END
------解决方案--------------------把动态的sql语句print出来看看!