473,624 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to fix Invalid object name errors on working query?

347 Contributor
I have the following query:

insert into msbtotal.dbo.ne wclients
SELECT distinct tcms_members.db o.memberdata2.* FROM tcms_members.db o.memberdata2 left outer join
msbtotal.dbo.me mberdata on tcms_members.db o.memberdata2.i d =
msbtotal.dbo.me mberdata.id where msbtotal.dbo.me mberdata.id is
null

and when I try to run this, I get the following error:

Invalid object name 'msbtotal.dbo.n ewclients'.

I've removed the msbtotal.dbo from this and then will get the error:

Invalid object name "newclients " ..... I had this as a scheduled job in SQL Server Agent jobs and now it's not working. Can anyone suggest a reason as to why it's not working?
Feb 8 '11 #1
8 23683
Rabbit
12,516 Recognized Expert Moderator MVP
Have you checked the table? Maybe someone accidentally renamed it or deleted it. Or maybe someone accidentally changed the permissions on the table.
Feb 8 '11 #2
dougancil
347 Contributor
That query is supposed to create a table called newclients. I did check the table and also that database and reset the permissions, and I'm still getting the error. this stopped working yesterday and the change I made was to make all of the references to the database be msbtotal.dbo.ne wclients. So the process I have are these 4 steps:

1. insert into msbtotal.dbo.ne wclients
SELECT distinct tcms_members.db o.memberdata2.* FROM tcms_members.db o.memberdata2 left outer join
msbtotal.dbo.me mberdata on tcms_members.db o.memberdata2.i d =
msbtotal.dbo.me mberdata.id where msbtotal.dbo.me mberdata.id is
null
GO
SET QUOTED_IDENTIFI ER OFF
GO
SET ANSI_NULLS ON
GO

2.select distinct * into newclients2
from msbtotal.dbo.ne wclients

3. drop table msbtotal.dbo.ne wclients

4. sp_rename 'newclients2', 'newclients'
Feb 8 '11 #3
Rabbit
12,516 Recognized Expert Moderator MVP
I don't understand, why do you have an intermediary table? Can't you truncate new clients before inserting into it? Or can't you just do the insert? Is there a reason why you have to insert into an intermediary table before dropping the original and renaming it?

What was the process before you made the changes?
Feb 8 '11 #4
dougancil
347 Contributor
There doesnt have to be an intermediary table, I just created this job and was going to go back later and clean it up (which I never did ... obviously.) What I changed in the steps was instead of just referring to the table as newclients, I changed them to msbtotal.dbo.ne wclients so in other words

this line:
from msbtotal.dbo.ne wclients
was originally this
from newclients
Feb 8 '11 #5
Rabbit
12,516 Recognized Expert Moderator MVP
Are you able to do a select from that table outside of the process?
Feb 8 '11 #6
dougancil
347 Contributor
From the table newclients? That table doesnt exist currently. The table is created with the query.
Feb 8 '11 #7
Rabbit
12,516 Recognized Expert Moderator MVP
If it doesn't exist right now, it's not going to create it. An insert into will not create a table. A select into will though.
Feb 8 '11 #8
dougancil
347 Contributor
Rabbit,

it seems that there was originally a newclients table but that had been deleted, hence causing this issue. I've added the table back and have been able to execute the job as needed.
Feb 8 '11 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

2
13889
by: rockie12 | last post by:
I have a db that has a table x in it called data1 I have a program that does to things, updates values in the data1 table and also inserts new rows into this table. The update existing values works great. Then when the insert loop runs, I get this error on the following line. insert into data1 ('AdminManageLogIn','Password') Values ('123','222') Server: Msg 208, Level 16, State 1, Line 1
10
20997
by: FreeOperator | last post by:
Dear all, On Win2000 server with SP3, I am trying to access a SQL Server 7.0 database, "TestDB", from VB6 via a SQL Server ODBC system DSN using ADO 2.7. In SQL Server Enterprise Manager, there is a login named "Tester". In its property window, NO "Server Roles" was assigned but its "Database Access" was set to "TestDB". This login was also made as the user of "TestDB" with "public", "db_datareader" and "db_datawriter" selected as its...
3
3674
by: Mr.KisS | last post by:
Hello all, I'm working with : WinXP PRO SP1, MS SQL 2005 Express, Visual Web Dev 2005 Express. I have an aspx page which must execute a stored procedure : ______________ try { myCommand.ExecuteNonQuery();
2
2057
by: darrel | last post by:
I'm trying to delete a record in a table: Dim strConnect As String = System.Configuration.ConfigurationSettings.AppSettings("myConnectionString") Dim strChk = "DELETE FROM we_admin_users WHERE UserID='" & myUserID & "'" Dim objConnect As New System.Data.OleDb.OleDbConnection(strConnect) objConnect.Open() Dim objCommand As New System.Data.OleDb.OleDbCommand(strChk, objConnect) objCommand.ExecuteNonQuery()
3
7417
by: ianforgroupuse | last post by:
I'm running Vista Business edition on 2005 Virtual PC. Installed SQL Server 2005 Express latest download, with instance of MSSQLSERVER and service accounts running under "NT AUTHORITY\SYSTEM". Mixed mode authentication specified and sa password specified. Used server manager to create user login with sysadmin role. Login using windows authentication. Run my application and database is created and populated with default records.
1
1652
by: moni | last post by:
Hi, I am using a table named PersonInfo in my database monisha in the SQL server. I need to use this in a .aspx file , but its giving me the error of invalid object name. <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ConnectionStrings:monishaCS%>" SelectCommand="SELECT , , ,
1
3163
by: imranabdulaziz | last post by:
Dear All, I am using sql2005. i am writing stored procedure to save various master data . I recognize master by @type (input verible) and assign it to @mst veriable then based on @mst no I perform saving task . I created sp . now I am trying to execute then I am getting error “Invalid object name 'SizeMst'. “ I am running this query from its database. Stored perocedure is Alter procedure . @type int ,
1
1602
Dököll
by: Dököll | last post by:
Greetings, Good buddies! This one is kind of simple but I am not able to figure out. I am gettting this error: Invalid Object name... I have no idea why I am not connecting to the Server, tests went fine. Here is a query, skillfully written:-)
4
3346
by: Curious | last post by:
I got an exception when executing the SQL statement in my code below. The error is "Invalid object name 'db_dynamic_trading.dbo.TrdRpt_broker_list'". I know for a fact that 'db_dynamic_trading.dbo.TrdRpt_broker_list' is valid, because I can run the same SQL statement in Management Studio and it works. Any advice on this? Is there anything wrong with my connection string (although there is no complaint about the connection string in my
0
8173
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8621
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8475
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7159
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6110
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5563
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
1785
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1482
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.