I am working on a SSIS package. I needed a SQL query to be executed as a part of it.
IF NOT EXISTS (SELECT * FROM sys.objects
WHERE object_id = Object_id(N'[dbo].[ProcCalls]')
AND type IN (N'U'))
BEGIN
CREATE TABLE [dbo].[ProcCalls]
(
[ProcedureName] VARCHAR(100),
[ProcedureCall] VARCHAR(MAX),
[PodName] VARCHAR(50),
[AccountName] VARCHAR(50),
[OrganizationID] VARCHAR(50),
[CenterID] VARCHAR(50)
)
END
GO
TRUNCATE TABLE [ProcCalls]
I tried using both direct input and file connection input but both the times build query tab fails and I get this error:
Unable to parse query text
Also upon execution, the package fails
PS: stackoverflow.com/a/11128418 This answer worked for me. I did put queries not starting with CREATE/ALTER in Exec() and the package executed successfully.