July 24, 2015 at 3:06 am
DECLARE @ServiceStatus TABLE
(ServerName varchar(128)
,ServiceName varchar(128)
,StatusOfService varchar(128)
,StatusAsOn datetime)
INSERT INTO @ServiceStatus (StatusOfService)
EXEC master..xp_servicecontrol 'QueryState', 'msdtc'
UPDATE @ServiceStatus
SET ServerName=cast(@@SERVERNAME as varchar(128))
,ServiceName='Microsoft Distributed Transaction Coordinator'
,StatusAsOn=GETDATE()
--WHERE ServerName IS NULL
SELECT * FROM @ServiceStatus
The above code is part of a data flow task - code is in ole db source as sql code with a ole db destination(a sql table).I can preview the result in the ole db source but upon executing the data flow task the data is not inserted.The data flow task turns green with no data being inserted.
Can someone please help fix this.I need the data to be inserted into the ole db destination(sql table) when I run the data flow task.
Thanks
July 24, 2015 at 4:07 am
metroman17 (7/24/2015)
DECLARE @ServiceStatus TABLE(ServerName varchar(128)
,ServiceName varchar(128)
,StatusOfService varchar(128)
,StatusAsOn datetime)
INSERT INTO @ServiceStatus (StatusOfService)
EXEC master..xp_servicecontrol 'QueryState', 'msdtc'
UPDATE @ServiceStatus
SET ServerName=cast(@@SERVERNAME as varchar(128))
,ServiceName='Microsoft Distributed Transaction Coordinator'
,StatusAsOn=GETDATE()
--WHERE ServerName IS NULL
SELECT * FROM @ServiceStatus
The above code is part of a data flow task - code is in ole db source as sql code with a ole db destination(a sql table).I can preview the result in the ole db source but upon executing the data flow task the data is not inserted.The data flow task turns green with no data being inserted.
Can someone please help fix this.I need the data to be inserted into the ole db destination(sql table) when I run the data flow task.
Thanks
I would suggest creating a proc which contains this code and using your proc as the data source.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
July 31, 2015 at 12:29 am
I cannot create a Stored proc across 100's of servers.
I will be running this code across servers from the SSIS package.
August 2, 2015 at 10:16 am
Do you even need the table variable? Seems to me that you are creating the table variable strictly for the purpose of performing a relatively trivial update on the result set from the sproc master..xp_servicecontrol.
I'd recommend using EXEC master..xp_servicecontrol as your data flow source query, and then update those three columns in a Derived Column transformation. This will eliminate the need for the table variable entirely.
Tim Mitchell, Microsoft Data Platform MVP
Data Warehouse and ETL Consultant
TimMitchell.net | @Tim_Mitchell | Tyleris.com
ETL Best Practices
August 2, 2015 at 11:52 am
Tim Mitchell (8/2/2015)
Do you even need the table variable? Seems to me that you are creating the table variable strictly for the purpose of performing a relatively trivial update on the result set from the sproc master..xp_servicecontrol.I'd recommend using EXEC master..xp_servicecontrol as your data flow source query, and then update those three columns in a Derived Column transformation. This will eliminate the need for the table variable entirely.
Good advice. Might need to add With Result Sets so that the component knows what sort of data it's dealing with.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
August 2, 2015 at 12:04 pm
metroman17 (7/31/2015)
I cannot create a Stored proc across 100's of servers.I will be running this code across servers from the SSIS package.
Are all those servers on the same domain?
As a bit of a sidebar, I'd love to see your license budget for the 100's of servers.
--Jeff Moden
Change is inevitable... Change for the better is not.
August 4, 2015 at 4:40 am
Thanks but...
Why is the existing one not working?
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply