关键字表附近的语法不正确

时间:2014-06-04 07:02:37

标签: sql sql-server stored-procedures

我已经尽力解决这个问题,但到目前为止还没有。

此代码给出了错误:

MERGE Monitoring.MonitoringDataFilter T
                USING
                (
                    SELECT
                        MonitoringDataFilterID AS MonitoringDataFilterID
                )S 
                    ON T.MonitoringDataFilterID = S.MonitoringDataFilterID
                WHEN MATCHED
                THEN
                    UPDATE
                    SET
                        MonitoringDataId            = @MonitoringDataId,
                        FilterTypeId                = @FilterTypeID,
                        CreatedBy                   = @UserLogin,
                        CreatedDate                 = GETDATE()
                WHEN NOT MATCHED
                THEN    
                    INSERT 
                    // Error Near this     Monitoring.MonitoringDataFilter 
                    (
                        MonitoringDataID,   
                        FilterTypeID,       
                        CreateBy,
                        CreatedDate,            
                    )
                    SELECT 
                            MD.MonitoringDataID,
                            @FilterTypeID,
                            @UserLogin,
                            GETDATE() 
                    FROM 
                            Monitoring.MonitoringData MD 
                    WHERE 
                    MD.MonitoringID = @MonitoringID;

我是否可以获得有关如何解决此问题的帮助?

1 个答案:

答案 0 :(得分:0)

我认为你错过了[架构名称]

Database_Name.Schema_Name.Table_Name

i.e. Monitoring.dbo.MonitoringDataFilter