|
|
-
Mike Lewis Commented 5 Months ago through Ask | 10 Points
See [http://ola.hallengren.com][1]
You'll struggle to find a more comprehensive set of maintenance scripts. Index optimisation is one of them, and allows you to set your own thresholds for when to reorg or rebuild. I've created my own scripts in th...
|
-
Mike Lewis Commented 6 Months ago through Ask | 10 Points
If it's the same query but only the inputs to the dataversion range are changed then a plan guide should do the trick. Look it up, it's a useful feature, which is particularly good for optimising queries for 3rd party tools when you can't get access to...
|
-
Mike Lewis Commented 6 Months ago through Ask | 10 Points
Is it a parameterised query causing the problem? Would a plan guide do the trick? If the query is only using a refactored plan depending on the dataversion values then a plan guide may work in this case, as you can tell the optimizer which plan to use...
|
-
Mike Lewis Commented 6 Months ago through Ask | 10 Points
In that case I'm going to recommend using dynamic sql. Never run dynamic sql where the sql is passed as a parameter, but in my example below it is fine as you are in total control of the sql being run.
Essentially, I'm suggesting specifying the WHE...
|
-
Mike Lewis Commented 6 Months ago through Ask | 10 Points
Is this script to form part of a stored proc? And is ColumnId an input parameter? Or is ColumnId a table column?
There are various options to achieve this but choosing the best one depends on the answers to my questions above, along with a few othe...
|
-
Mike Lewis Commented 6 Months ago through Ask | 10 Points
You can try creating an extra dataset that points to a SQL Server. In this SQL Server create a stored proc (ideally in a utility or DBA database) that sends emails - this will need to be configured for db mail.
Your SSRS dataset can then point to ...
|
-
Mike Lewis Commented 6 Months ago through Ask | 10 Points
Hi Ramkoti
You cannot disable this option, however there really should be no need to. If you don't wish to take the database offline, don't click on the option! There's no reason why you should click it accidentally due to its location in the menu....
|
-
Mike Lewis Commented 7 Months ago through Ask | 10 Points
Here's what I'm talking about with the dynamic SQL. It doesn't include the final summary row at the bottom but it gives you an idea as to how a dynamic PIVOT statement can be constructed:
if object_id('tempdb..#pivot') is not null
drop tab...
|
-
Mike Lewis Commented 7 Months ago through Ask | 10 Points
Hi Bubai,
If the UserName comes from a database table, and the query needs dynamically pull in those UserNames, then your only option is to construct a PIVOT query using dynamic SQL. It's not straightforward, especially as you're trying to sum times...
|
-
Mike Lewis Commented 7 Months ago through Ask | 10 Points
Hi Emile,
It sounds as though you need to get the CalcDate out of the stored proc? If so, then it really depends on the results of the first query. If it always returns a single row then this can be done by defining an output variable, e.g.
...
|