Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL 2005 Maintenance Plan error.

Status
Not open for further replies.

nondrinker

Programmer
Jan 23, 2002
53
US
Hello,
I have been to trying add a new maintenace package.
I chose the "Execute T-SQL Statementtask", and all i am trying to do here is run an insert statment. But whenever i try to run it, it gives me this error:


Executing the query "Insert INTO Test3 (EmployeeID, Name) VALUES ('100', 'TestName');
Insert INTO Test3 (EmployeeID, Name) VALUES ('37', 'Ryan')" failed with the following error: "Invalid object name 'Test3'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

**************************
I have created the table Test3 just for the test purposes but for sme reason the maintenece package is not finding it. If i run this statement in the New Query window then it runs fine and inserts the records in, but not if try to run it as a Maintenace task.
Thank you.
 
Are you including the database name? It probably defaults to master or msdb.

Denny
MCSA (2003) / MCDBA (SQL 2000) / MCTS (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
I didn't see any option of spefiying a database name.
I tried:

Insert INTO DatabaseName.Test3 (EmployeeID, Name) VALUE ('100', 'TestName')

But i got the same error.
 
Do you know what schema you created this new table in? If you are qualifying it with the database name you also need to include the schema name. Ex: DBName.Schema.Table

In SSIS, the Database name is defined in a connection and the connection is referenced on the General tab of the Execute SQL Task.
 
Ok finally it worked.

DatabaseName.dbo.Tablename(EmployeeID, Name) VALUES ('100', 'TestName')
 
BTW: we have a new SSIS forum forum1555 available to us.

Denny
MCSA (2003) / MCDBA (SQL 2000) / MCTS (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top