[dba-SQLServer] Invalid Object name, SQL 2012

David McAfee davidmcafee at gmail.com
Thu Apr 4 17:29:38 CDT 2013


You learn something new every day.

Thanks for that!

David


On Wed, Apr 3, 2013 at 4:48 PM, <Elizabeth.J.Doering at wellsfargo.com> wrote:

> In SSMS
> Edit-->Intellisense-->Refresh Local Cache
>
> Should fix it right up.
>
> Maddening however, that it doesn't just refresh itself at intervals.
>
> Liz
>
> This message may contain confidential and/or privileged information.  If
> you are not the addressee or authorized to receive this for the addressee,
> you must not use, copy, disclose, or take any action based on this message
> or any information herein.  If you have received this message in error,
> please advise the sender immediately by reply e-mail and delete this
> message.  Thank you for your cooperation.
>
> -----Original Message-----
> From: dba-sqlserver-bounces at databaseadvisors.com [mailto:
> dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Paul Hartland
> Sent: Wednesday, April 03, 2013 1:54 PM
> To: Discussion concerning MS SQL Server
> Subject: Re: [dba-SQLServer] Invalid Object name, SQL 2012
>
> Ah it just needed refreshing then, what I got into the habit of was if I
> created a new table in a database, before I done anything else I would
> right click the tables branch (as I call it) under my database and click
> refresh to refresh all tables.
>
>
> On 3 April 2013 19:49, David McAfee <davidmcafee at gmail.com> wrote:
>
> > Yes, it was.
> >
> >
> > On Wed, Apr 3, 2013 at 11:36 AM, Paul Hartland <
> > paul.hartland at googlemail.com
> > > wrote:
> >
> > > I would assume that that table was the last one you created
> > >
> > >
> > > On 3 April 2013 19:23, David McAfee <davidmcafee at gmail.com> wrote:
> > >
> > > > Yup that was it. I closed the stp and reopened it and I was still
> > seeing
> > > > the red lines.
> > > >
> > > > I closed all of my SSMS windows and reopened SSMS and it was opened.
> > > >
> > > > How weird that only one table was giving me the false error.
> > > >
> > > > Thanks,
> > > > David
> > > >
> > > >
> > > >
> > > > On Wed, Apr 3, 2013 at 10:52 AM, James Barash <james at fcidms.com>
> > wrote:
> > > >
> > > > > David:
> > > > >
> > > > > I see that all the time. It's some sort of bug in Management
> Studio.
> > If
> > > > > you create a table and then create a stored procedure without
> > > > > closing Management Studio, you will get the Invalid Object
> > > > > message. As long
> > as
> > > > the
> > > > > query runs, there won't be any problems.
> > > > > Once you close and reopen Management Studio, everything will be
> fine.
> > > At
> > > > > least that has been my experience.
> > > > >
> > > > > James Barash
> > > > >
> > > > > -----Original Message-----
> > > > > From: dba-sqlserver-bounces at databaseadvisors.com [mailto:
> > > > > dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of David
> > McAfee
> > > > > Sent: Wednesday, April 03, 2013 1:15 PM
> > > > > To: Discussion concerning MS SQL Server
> > > > > Subject: [dba-SQLServer] Invalid Object name, SQL 2012
> > > > >
> > > > > Have any of you come across this error?
> > > > >
> > > > > I am running a local instance of SQL 2012 on my box.
> > > > > I created a few tables and I am now creating a stored procedure.
> > > > >
> > > > > In the procedure, I get a red underline under one of the table
> names.
> > > > >
> > > > > When I mouse over the red underline, it displays: "Invalid
> > > > > object
> > name
> > > > > 'tblTerritoryRsmJunct'"
> > > > >
> > > > > The select statement DOES work and return the correct values.
> > > > >
> > > > >
> > > > > SELECT
> > > > >      R.RegionDesc,
> > > > >      GSM.Fullname AS GSM,
> > > > >      RSM.Fullname AS RSM,
> > > > >      T.Territory,
> > > > >      T.TerrID AS TerritoryID
> > > > > FROM tblRegion R (NOLOCK)
> > > > >   INNER JOIN tblUser GSM (NOLOCK) ON R.GsmUserGuid = GSM.UserGuid
> > > > >   INNER JOIN tblTerritory T (NOLOCK) ON T.RegionID = R.RegionID
> > > > >   INNER JOIN (SELECT TerritoryID, MAX(entryDate) as MaxDate
> > > > >                       FROM tblTerritoryRsmJunct (NOLOCK)
> > > > >                       WHERE entryDate < @AsOfDate
> > > > >                       GROUP BY TerritoryID) AS RJ1 ON T.TerrID =
> > > > > RJ1.territoryid
> > > > >   INNER JOIN tblRouteSellerJunct AS RJ2 (NOLOCK)
> > > > >         ON RJ1.territoryID = RJ2.TerritoryID
> > > > >       AND RJ1.MaxDate = RJ2.entryDate
> > > > >   INNER JOIN tblUser RSM (NOLOCK) ON RSM.UserGuid = RJ2.RsmGuid
> > > > >
> > > > >
> > > > > I've even dragged in the table name from the Object explorer so
> > > > > it
> > > reads:
> > > > > [dbo].[tblRouteSellerJunct] but it still underlines it in red.
> > > > >
> > > > > The file name is 20 characters long. I've named tables with
> > > > > longer
> > > names
> > > > > before.
> > > > >
> > > > > Any ideas?
> > > > >
> > > > > Thanks,
> > > > > David
> > > > > _______________________________________________
> > > > > dba-SQLServer mailing list
> > > > > dba-SQLServer at databaseadvisors.com
> > > > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> > > > > http://www.databaseadvisors.com
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > _______________________________________________
> > > > > dba-SQLServer mailing list
> > > > > dba-SQLServer at databaseadvisors.com
> > > > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> > > > > http://www.databaseadvisors.com
> > > > >
> > > > >
> > > > _______________________________________________
> > > > dba-SQLServer mailing list
> > > > dba-SQLServer at databaseadvisors.com
> > > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> > > > http://www.databaseadvisors.com
> > > >
> > > >
> > >
> > >
> > > --
> > > Paul Hartland
> > > paul.hartland at googlemail.com
> > > _______________________________________________
> > > dba-SQLServer mailing list
> > > dba-SQLServer at databaseadvisors.com
> > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> > > http://www.databaseadvisors.com
> > >
> > >
> > _______________________________________________
> > dba-SQLServer mailing list
> > dba-SQLServer at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> > http://www.databaseadvisors.com
> >
> >
>
>
> --
> Paul Hartland
> paul.hartland at googlemail.com
> _______________________________________________
> dba-SQLServer mailing list
> dba-SQLServer at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> http://www.databaseadvisors.com
>
>
> _______________________________________________
> dba-SQLServer mailing list
> dba-SQLServer at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> http://www.databaseadvisors.com
>
>


More information about the dba-SQLServer mailing list