Posts

Get last data change of table (including deletes)

Will probably not work on heap (non clustered) tables select   object_name ( s . object_id )   as   TableName ,           i . name                     as   IndexName ,           last_user_update   --,s.*   from     sys . dm_db_index_usage_stats   s           join   sys . indexes   i             on   i . index_id   =   s . index_id                and   i . object_id   =   s . object_id   where    object_name ( s . object_id )   =   'myTable'  

T-sql procedure to wait for sql server agent job

/*   Awaits job to finish, then returns job_status   0 = Failed   1 = Succeeded   2 = Retry   3 = Canceled   null = Job never executed / no history   If job was executed and already finished successfully before this proc starts, it will return 1 (success) */   create   procedure   tools . AwaitSqlServerAgentJob      @jobName   sysname   as      declare   @jobid   uniqueidentifier   =   ( select   job_id   from   msdb . dbo . sysjobs   where   name   =   @jobname   )    declare   @sessionId   int   =   ( select   max ( session_id )   from   msdb . dbo . sysjobactivity ...

Solution: Stopping SSIS package causing "Unable to terminate process (reason: Access is denied)"

I had big problems finding the solution to the message [Job Name]:  Unable to terminate process  [pid]  launched by step  [x]  of job  [guid]  (reason: Access is denied). that fired when trying to stop Sql server agent jobs running step type "SQL Server Integration Services Package" Some suggested changing the job owner to sa or troubleshooting access. These suggestions did not fix it in my environment. Fix Change Step type from "SQL Server Integration Services Package" to "Operating System Command", and execute dtexec manually like so: dtexec /FILE "\"\\your file path.dtsx\"" /CHECKPOINTING OFF /REPORTING E The options are not relevant for my scenario, it was the type: Operating System Command that fixed it.

Cause for Parameter is incorrect 0x80070057 error in ssis

Image
Possible cause for the cryptic error The package failed to load due to error  0x80070057 "The p arameter is incorrect.". This occurs when CPackage::LoadFrommXML fails.  ...when opening or executing and SSIS package In my case i created the ssis package using biml. And accidentally created a duplicate precedence constraint to another task twice. Removing the duplicate constraint and re-generating the package solved it.

Get related measure without sumx

To create a measure (RelatedSales) in a filtered spine/factless table (ManySideTableThatIsFiltered), that relates to another table containing a measurable field (SalesAmount) RelatedSales :=  calculate ( sum ( [SalesAmount] ) ,  values ( ManySideTableThatIsFiltered ) )

Why is does my Live Mist Biml script fails to generate packages to Logical View?

Why is does not my live Mist Biml script generate packages, even though i can see the expanded packages in the Preview Expanded Biml script? In my case, the loop creating the packages was based on tables generated from another live script. This "double-hop" live scripting is supported. The key to success is using tiers <#@ template language="C#" tier="1" #> <#@ template language="C#" tier="2" #> <#@ template language="C#" tier="3" #>

Biml / Mist cryptic errors demystified

Error:: BimlScript expected X properties, but Y were supplied Provide required properties The required attribute on parameter object does not seem to work when using CallBimlScript example:  <#@ property name="parameterValue" type="System.String" required="False" #> Workaround: Specify empty/null parameter in CallBimlScript then use string.IsNullOrEmpty(parameterValue) in your callee script. Error When building biml script i get " Error:Node: Varigence.Biml.SsisEmitter.Model.Dataflow.Input:   Expression  contains syntax errors"  No error lines or task names are shown. Cause  / Solution This message actually means that one of your tasks have an empty ssis expression (Note the double space between "Expression  contains". Examples could be columns inside a . Check recent added tasks for missing expressions. Error Cannot build biml file in mist that has an ssis expression containing double ampersands "...