Forum Discussion
DebbieE
6 years agoCommunity Champion
Creating Powershell to run a push data set over SQL DB
I have created a push dataset for real time data straming in Power BI Service Using the how to guides Im creating Powershell to run it. However Im getting errors so if anyone knows Powershell...
- 6 years ago
Hi DebbieE ,
try this.
$query = @' CREATE @TableName Varchar(200) = ('dim.Realtimedatatestingcustomer'); DECLARE @MaxUpdateDate DateTime = (SELECT MAX(UpdateDate) FROM [dim].[RealTimedatatestingcustomerDE]); DECLARE @OldUpdateDate DateTime = (SELECT ISNULL([UpdateDate],0) FROM audit.RealTimeDataAudit WHERE TableName = @TableName); UPDATE audit.RealTimeDataAudit SET [UpdateDate] = @MaxUpdateDate WHERE TableName = @TableName; SELECT [CustKey], [Name], [UpdateDate] FROM [dim].[RealTimedatatestingcustomerDE] WHERE [UpdateDate] = @MaxUpdateDate; '@
mwegener
6 years agoMost Valuable Professional
Hi DebbieE ,
try this.
$query = @'
CREATE @TableName Varchar(200) = ('dim.Realtimedatatestingcustomer');
DECLARE @MaxUpdateDate DateTime = (SELECT MAX(UpdateDate) FROM [dim].[RealTimedatatestingcustomerDE]);
DECLARE @OldUpdateDate DateTime = (SELECT ISNULL([UpdateDate],0) FROM audit.RealTimeDataAudit WHERE TableName = @TableName);
UPDATE audit.RealTimeDataAudit
SET [UpdateDate] = @MaxUpdateDate
WHERE TableName = @TableName;
SELECT [CustKey], [Name], [UpdateDate] FROM [dim].[RealTimedatatestingcustomerDE]
WHERE [UpdateDate] = @MaxUpdateDate; '@