2

我正在做一个stored procedurein SQL SERVER 2012

突然,我的存储过程无法编译。

invalid column name在我尝试添加的每一列上都有说明。

但是我可以运行查询并且列在那里

SELECT FirstName FROM dbo.Contacts

另外,我没有更改代码。

  • 我试图重新启动

  • 我重新创建了列

  • 我刷新了intelliSense缓存

没运气...

这是代码的一部分

DECLARE curContact Cursor

FOR SELECT dbo.Contacts.ContactID, dbo.Contacts.FirstName, dbo.Contacts.MiddleName, dbo.Contacts.LastName, dbo.Contacts.ContactName FROM dbo.Contacts
FOR UPDATE OF  dbo.Contacts.FirstName, dbo.Contacts.MiddleName, dbo.Contacts.LastName
OPEN curContact

这是表结构

CREATE TABLE [dbo].[Contacts](
    [ContactID] [int] NOT NULL,
    [MillID] [int] NULL,
    [ClientID] [int] NULL,
    [FirstName] [nvarchar](64) NULL,
    [MiddleName] [nvarchar](64) NULL,
    [LastName] [nvarchar](64) NULL,
    [Gender] [bit] NULL,
    [ContactName] [nvarchar](50) NULL,
    [ContactTitle] [nvarchar](50) NULL,
    [ContactPhoneNo] [nvarchar](50) NULL,
    [ContactPhoneExt] [nvarchar](50) NULL,
    [ContactFaxNo] [nvarchar](50) NULL,
    [ContactEmail] [nvarchar](50) NULL,
    [Comment] [nvarchar](max) NULL,
    [CreatedBy] [nvarchar](50) NULL,
    [CreatedDate] [datetime] NULL,
    [ModifiedBy] [nvarchar](50) NULL,
    [ModifiedDate] [datetime] NULL,
    [ContactCellNo] [nvarchar](50) NULL,
    [ContactPageNo] [nvarchar](50) NULL,
    [ContactHomeNo] [nvarchar](50) NULL,
    [ContactOtherNo] [nvarchar](50) NULL,
    [Language] [nvarchar](15) NULL,
    [CalendarQuantityEnglish] [smallint] NULL,
    [CalendarQuantityFrench] [smallint] NULL,
    [CalendarKeepBy] [nvarchar](50) NULL,
    [CalendarComment] [nvarchar](250) NULL,
    [OtherQuantityEnglish] [smallint] NULL,
    [OtherQuantityFrench] [smallint] NULL,
    [OtherKeepBy] [nvarchar](50) NULL,
    [OtherComment] [nvarchar](250) NULL,
    [Validated] [date] NULL,
    [ValidedByWho] [nvarchar](64) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

任何的想法?

4

1 回答 1

12

您需要刷新 SSMS Intellisense 缓存(CTRL + SHIFT + R 或编辑 -> Intellisense -> 刷新本地缓存)。

于 2014-05-09T18:46:42.007 回答