SmashAndGrab
asked on
How to NOT reference database in SQL statement (SSIS package)
Hi,
I have created an SSIS package that contains SQL statement blocks (see image).
My question is:
How do I remove the reference to the database name from within the SQL statement? I am already using a connection.
I tried copying the SQL code that is in the drop table SQL but I keep getting an error.
Current:
INSERT INTO ServeMe_PROD.dbo.change_re quest
SELECT * FROM ServeMe_PROD.dbo.change_re quest_temp
New:
INSERT INTO [dbo].change_request
SELECT * FROM [dbo].change_request_temp
GO
It doesn't work at the moment and I'm not sure why.
Hope someone can help.
Thanks
Stuart
I have created an SSIS package that contains SQL statement blocks (see image).
My question is:
How do I remove the reference to the database name from within the SQL statement? I am already using a connection.
I tried copying the SQL code that is in the drop table SQL but I keep getting an error.
Current:
INSERT INTO ServeMe_PROD.dbo.change_re
SELECT * FROM ServeMe_PROD.dbo.change_re
New:
INSERT INTO [dbo].change_request
SELECT * FROM [dbo].change_request_temp
GO
It doesn't work at the moment and I'm not sure why.
Hope someone can help.
Thanks
Stuart
ASKER
Does it not need the [dbo]?
This statement works perfectly..
drop table [dbo].[incident_temp]
GO
This statement works perfectly..
drop table [dbo].[incident_temp]
GO
ASKER
[Execute SQL Task] Error: Executing the query "INSERT INTO ServeMe_PROD.dbo.incident;
SELECT * FR..." failed with the following error: "Incorrect syntax near ';'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
SELECT * FR..." failed with the following error: "Incorrect syntax near ';'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
ASKER
[Execute SQL Task] Error: Executing the query "INSERT INTO dbo.incident;
SELECT * FROM dbo.incide..." failed with the following error: "Incorrect syntax near ';'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
SELECT * FROM dbo.incide..." failed with the following error: "Incorrect syntax near ';'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
ASKER
The above error (2nd one) is caused when I run this...
INSERT INTO dbo.incident;
SELECT * FROM dbo.incident_temp
INSERT INTO dbo.incident;
SELECT * FROM dbo.incident_temp
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
INSERT INTO change_request ;
SELECT * FROM change_request_temp
what error was returned here?