Codechef4u is a community for computer professionals,by computer professionals,just like you; who loves sharing and helping each others,Join them
Share your post

Invalid object name ‘tableName’ with Database

I am trying to create a Stored Procedure for a newly created database. However the SSMS intellisense does not recognize many tables from new database.

-- =============================================
-- Author:                    Nagnath Kendre
-- Create date: 24/10/2015
-- Description: Create leave type
-- =============================================
CREATE PROCEDURE CreateLeaveType
            -- Add the parameters for the stored procedure here
 @LeaveTitle [nvarchar](100),
 @Description [nvarchar](200),
 @UserId UNIQUEIDENTIFIER
AS
BEGIN
            -- SET NOCOUNT ON added to prevent extra result sets from
            -- interfering with SELECT statements.
SET NOCOUNT ON;
 
INSERT INTO dbo.LeaveType
        (
                                    LeaveTitle,
                                    [Description],
                                    AddedBy,
                                    CreatedDate)
                                    values
                                    (@LeaveTitle,
                                     @Description,
                                     @UserId,
                                     GETDATE()
                                    )
 
END
GO


i.e for table LeaveType I am getting error like

Invalid object name 'LeaveType'.

 

Fix:

Edit -> IntelliSense -> Refresh Local Cache
This should refresh the data cached by Intellisense. 

Share your answer


Share as a guest

Please subscribe me to the CodeChef4U.

By creating your new answer, you agree to the privacy policy and terms of service.