Sql Server management studio "Invalid Object name dbo.xxxxx"
Solution 1
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.
Solution 2
Make sure you have selected the right database on which you run the query. That was my issue.
Srikanth
Developer having skills in C#, Asp.net,Asp.net MVC4, Winforms,WPF, Crystal reports,SQL Server, good exposure to visual studio <=2017. Loves my kid Aineesh more than cricket..... :)
Updated on October 17, 2020Comments
-
Srikanth over 3 years
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