I have created a EmpDB and created a table "EmpTable" when I try to create a simple SP I am getting compile time error "Invalid Object name dbo.EmpTable" - why?
Following is the sql statements
use EmpDB;
Go
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE usp_GetEmpNames
AS
SELECT * FROM dbo.EmpTable
I just created a test version and ran your script with any issues.
A few things to check:
If you run just the SELECT
does it run?
SELECT * FROM dbo.EmpTable
If not, then verify the schema the EmpTable is in and replace the dbo.
SELECT * FROM yourSchemaNameGoesHere.EmpTable
Make sure that your table that you created is in the correct database EmpDB
and you didn't accidentally create your table in the wrong database.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.