<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3581668942031605287</id><updated>2025-09-20T16:30:00.243+01:00</updated><category term="SSRS Expressions"/><title type='text'>Reporting Services Tips n Tricks</title><subtitle type='html'>This blog contains tips and tricks for reporting services 2005/2008R2/2016&#xa;&#xa;&quot;This blog is provided &#39;AS IS&#39; with no warranties, and confers no rights.&quot;</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://reportingservicestnt.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://reportingservicestnt.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>abs</name><uri>http://www.blogger.com/profile/08183235261376957091</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>24</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3581668942031605287.post-3569236718663148772</id><published>2018-01-03T10:51:00.002+00:00</published><updated>2018-01-10T13:56:19.365+00:00</updated><title type='text'>Keep SSRS (SSRS2016) report manager awake</title><content type='html'>&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: medium;&quot;&gt;When running a report for the first time in report manager it takes a while to run, after this initial run reports run fine.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: medium;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: medium;&quot;&gt;There are a number of ways to keep reporting services awake so that when you run a report it runs straight away and is not slow to load.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: medium;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: medium;&quot;&gt;I have found a number of scripts on the web but I could not get them to work, so I created my own and tweaked it and it works! :-)&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: medium;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: medium;&quot;&gt;The idea is to run a report using PowerShell with a URL and then create a job which will run the job before your users start running reports.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: medium;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: medium;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: medium;&quot;&gt;The PowerShell script below runs a report&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: medium;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: medium;&quot;&gt;$IE=new-object -com internetexplorer.application&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: medium;&quot;&gt;$IE.navigate2(&quot;ENTERREPORTURLLINKHERE&quot;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: medium;&quot;&gt;$IE.visible=$true&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: medium;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: medium;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: medium;&quot;&gt;Test the script in PowerShell on your server and then save the file.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: medium;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: medium;&quot;&gt;Then create a SQL Agent job which you then schedule to run every day at say 6am.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: medium;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: medium;&quot;&gt;This works on SSRS 2016 I have not tested on previous versions but it should work in principle&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://reportingservicestnt.blogspot.com/feeds/3569236718663148772/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://reportingservicestnt.blogspot.com/2018/01/keep-ssrs-report-manager-awake.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/3569236718663148772'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/3569236718663148772'/><link rel='alternate' type='text/html' href='http://reportingservicestnt.blogspot.com/2018/01/keep-ssrs-report-manager-awake.html' title='Keep SSRS (SSRS2016) report manager awake'/><author><name>abs</name><uri>http://www.blogger.com/profile/08183235261376957091</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3581668942031605287.post-4018760049446038033</id><published>2013-07-22T14:37:00.003+01:00</published><updated>2018-03-21T23:05:34.407+00:00</updated><title type='text'>Extracting Users from Windows Groups on Report Server</title><content type='html'>&lt;br /&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;There may be occasions when using
windows active security is not ideal so you may need to create and maintain
your own windows groups for security on reports. One of the downfalls is to be
able to extract a list of the windows groups you have on the server and
presenting it to management. It is quite frustrating to be asked about who the
users are for which groups and the recipients for report subscriptions.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;To
get round this issue I wrote some script to extract the groups and users from a
windows server, once extracted a report can be easily extracted so you can see
who has access.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;I
have used an SSIS package to do this:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;The
package runs a SP on the master database on the&amp;nbsp;SSRS server and then
inserts the data to another server which is used for reporting. The reason for
creating a package was due to not being able to insert the data to another
database on a different server.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;----------------------------------------------------&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;--SP
extracts the groups and users&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;----------------------------------------------------&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;proc
[dbo].[my_sp_servergroups]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;as&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;---------------------------------------------windows
groups&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;if
object_id (&#39;my_tbl_groups&#39;) is not null&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;drop
table my_tbl_groups&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;if
object_id (&#39;my_tbl_groups1&#39;) is not null&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;drop
table my_tbl_groups1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;create
table my_tbl_groups (groupname varchar(100))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;create
table my_tbl_groups1 (groupname varchar(100),group_name varchar(100), RowNumber
int)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;insert
into my_tbl_groups&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;exec
xp_cmdshell &#39;net localgroup&#39;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;delete
from my_tbl_groups where left(isnull(rtrim(groupname),&#39;MpTI&#39;),4)
&amp;lt;&amp;gt; &#39;*ssr&#39;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;insert
into my_tbl_groups1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;select
*,right(rtrim(groupname),len(rtrim(groupname))-1) as group_name,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;(select
count(*) from my_tbl_groups as b where b.groupname &amp;lt;= a.groupname)
&amp;nbsp; AS RowNumber&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;&amp;nbsp;from
my_tbl_groups a&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;--select
* from my_tbl_groups1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;-------------------------------------------------&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;------------------------------group
members&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;if
object_id (&#39;my_tbl_groupsmembers&#39;) is not null&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;drop
table my_tbl_groupsmembers&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;create
table my_tbl_groupsmembers (members char(200))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;if
object_id (&#39;my_tbl_servergroups&#39;) is not null&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;drop
table my_tbl_servergroups&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;create
table my_tbl_servergroups (members char(200), group_name char(200))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;DECLARE
@number_of_groups INT &amp;nbsp;set &amp;nbsp;@number_of_groups &amp;nbsp;= (select count(
distinct groupname) from my_tbl_groups1 )&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;DECLARE
@counter int set @counter= 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;declare
@text char(200)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;truncate
table my_tbl_servergroups&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;truncate
table my_tbl_groupsmembers&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;WHILE
@counter &amp;lt;= @number_of_groups&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;BEGIN&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp;set @text = (select &#39;net localgroup
&#39;+group_name from my_tbl_groups1 where rownumber = @counter )&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp;insert into my_tbl_groupsmembers exec
xp_cmdshell @text&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp;insert into my_tbl_servergroups&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;select *, (select group_name from my_tbl_groups1
where rownumber = @counter) as group_name &amp;nbsp;from my_tbl_groupsmembers&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;nbsp;truncate table my_tbl_groupsmembers&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;SET @counter = @counter + 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;END&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;delete
my_tbl_servergroups where left(isnull(members,&#39;Empty&#39;),6)&amp;lt;&amp;gt; &#39;&#39;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;----------------------------&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;--The
script below copies the data to another server&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;----------------------------&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;if
object_id (&#39;my_tbl_servergroups&#39;) is not null&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;drop
table dbo.my_tbl_servergroups&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;create
table my_tbl_servergroups (members char(200), group_name char(200))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;insert
into my_tbl_servergroups&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Arial&amp;quot;,sans-serif; font-size: 13.5pt;&quot;&gt;select
* &amp;nbsp; from [SERVERNAME].[master].[dbo].my_tbl_servergroups&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://reportingservicestnt.blogspot.com/feeds/4018760049446038033/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://reportingservicestnt.blogspot.com/2013/07/extracting-users-from-windows-groups-on.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/4018760049446038033'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/4018760049446038033'/><link rel='alternate' type='text/html' href='http://reportingservicestnt.blogspot.com/2013/07/extracting-users-from-windows-groups-on.html' title='Extracting Users from Windows Groups on Report Server'/><author><name>abs</name><uri>http://www.blogger.com/profile/08183235261376957091</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3581668942031605287.post-1336125358865391872</id><published>2012-11-13T13:16:00.001+00:00</published><updated>2018-03-21T23:06:12.588+00:00</updated><title type='text'>T SQL Concatenated Row Field</title><content type='html'>&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;When creating new reports you sometimes need to concatenate data:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;Below is sample script which will allow you to do this using a function.

&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;----------------------------------------------------------------------------&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;------&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;create table&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;----------------------------------------------------------------------------&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;with cte as (select 123 as customer, &#39;2012-09-18 00:00:00.000&#39; as orderdate&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;union all&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;select 123 as customer, &#39;2012-09-19 00:00:00.000&#39; as orderdate&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;union all&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;select 123 as customer, &#39;2012-09-20 00:00:00.000&#39; as orderdate&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;union all&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;select 124 as customer, &#39;2012-09-21 00:00:00.000&#39; as orderdate&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;union all&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;select 124 as customer, &#39;2012-09-22 00:00:00.000&#39; as orderdate&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif; white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;select * into CustomerOrder from cte&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif; white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif; white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif; white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif; white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;----------------------------------------------------------------------------&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;------&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;create function to concatenate dates&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;----------------------------------------------------------------------------&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;create &amp;nbsp; &amp;nbsp;function [dbo].[GetCustomerOrderDates](&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@customer varchar(20)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;returns varchar (8000)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;as&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;begin&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;declare @str varchar (8000)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;set @str = &#39;&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if @customer is null&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return &#39;&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif; white-space: pre;&quot;&gt;      &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;select @str = @str + cast(dayz as varchar(300))+&#39;: &#39; FROM&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;(select top 1000 customer, orderdate, &amp;nbsp;convert(char(2),datepart(d,orderdate))+&#39; &#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;+CONVERT(char(3),DATENAME(mm,orderdate)) &amp;nbsp;as&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;dayz&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;from &amp;nbsp;CustomerOrder&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;where customer =@customer&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;order by orderdate&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;) as derived&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif; white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif; white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if (len (@str) &amp;gt; 1)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;set @str = left(@str, len(@str) - 1)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif; white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;return (@str)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;End&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;----------------------------------------------------------------------------&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;------&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;run query and use function to return concatenated dates&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;----------------------------------------------------------------------------&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;select distinct customer, dbo.[GetCustomerOrderDates](123) as orderdates&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;from CustomerOrder&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://reportingservicestnt.blogspot.com/feeds/1336125358865391872/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://reportingservicestnt.blogspot.com/2012/11/t-sql-concatenated-row-field.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/1336125358865391872'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/1336125358865391872'/><link rel='alternate' type='text/html' href='http://reportingservicestnt.blogspot.com/2012/11/t-sql-concatenated-row-field.html' title='T SQL Concatenated Row Field'/><author><name>abs</name><uri>http://www.blogger.com/profile/08183235261376957091</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3581668942031605287.post-3610822474301471483</id><published>2012-11-08T09:43:00.000+00:00</published><updated>2018-03-21T23:06:56.418+00:00</updated><title type='text'>Create a data driven subscription for the last working day</title><content type='html'>&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;The standard scheduling reporting services 2008 r2 does not include the last day of the month.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;A workaround is to use sql code in a data driven subscription to create this schedule.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;The code is shown below:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;I have used a function to strip out the time ...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;CREATE &amp;nbsp;FUNCTION wfDateWithoutTime&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;(@datewithtime DATETIME)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;RETURNS SMALLDATETIME&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;AS&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;BEGIN&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;DECLARE @datestring AS VARCHAR(20)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;SET @datestring = CONVERT(VARCHAR(20),@datewithtime,101)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;RETURN CONVERT(SMALLDATETIME, @datestring)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;END&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;The t sql code is then used in the sql query of the data driven subscription as follows:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;with cte as&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;(select DATEADD(m, DATEDIFF(m, 0, GETDATE())+1, 0) -1 as tday)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;select * from cte where tday = (select dbo.wfdatewithouttime(getdate()))&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;You then need to set the data driven subscription to run on a daily basis. The subscription will then only run on the last day of the month.&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://reportingservicestnt.blogspot.com/feeds/3610822474301471483/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://reportingservicestnt.blogspot.com/2012/11/create-data-driven-subscription-for.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/3610822474301471483'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/3610822474301471483'/><link rel='alternate' type='text/html' href='http://reportingservicestnt.blogspot.com/2012/11/create-data-driven-subscription-for.html' title='Create a data driven subscription for the last working day'/><author><name>abs</name><uri>http://www.blogger.com/profile/08183235261376957091</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3581668942031605287.post-2715933052079236515</id><published>2012-10-23T16:42:00.000+01:00</published><updated>2012-10-23T16:42:31.255+01:00</updated><title type='text'>Duplex Printing</title><content type='html'></content><link rel='replies' type='application/atom+xml' href='http://reportingservicestnt.blogspot.com/feeds/2715933052079236515/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://reportingservicestnt.blogspot.com/2012/10/duplex-printing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/2715933052079236515'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/2715933052079236515'/><link rel='alternate' type='text/html' href='http://reportingservicestnt.blogspot.com/2012/10/duplex-printing.html' title='Duplex Printing'/><author><name>abs</name><uri>http://www.blogger.com/profile/08183235261376957091</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3581668942031605287.post-1061385155753646343</id><published>2012-08-16T11:29:00.003+01:00</published><updated>2012-11-13T13:17:58.724+00:00</updated><title type='text'>Conditional Page Breaks in SSRS 2008 r2</title><content type='html'>&lt;br /&gt;
I have recently been looking at conditional page breaks in SSRS 2008 r2 and did not know that it is possible to do via an expression.&lt;br /&gt;
&lt;br /&gt;
For example if you have say 2 tables in a report and you want to conditionally force a page break between the 2 so that they appear separately on 2 pages based on a parameter.&lt;br /&gt;
&lt;br /&gt;
This is possible, to do this first select the first table and then in the properties of the table under &#39;General&#39; and then &#39;Pagebreak&#39; change the break location to &#39;end&#39;. This will then force a page break at the end of the table one.&lt;br /&gt;
&lt;br /&gt;
To make the pagebreak conditional create a parameter called pagebreak with the available values of &#39;yes&#39; and &#39;no&#39;. Then in the properties for the table under the break location there is a field called &#39;Disabled&#39; click on the dop down and select the expression option, in the expression box type the expression as:&lt;br /&gt;
&lt;br /&gt;
=iif(Parameters!pagebreak.Value=&quot;no&quot;,True,False)&lt;br /&gt;
&lt;br /&gt;
When you run the report change the pagebreak parameter and you will see that this forces a page break when you select &#39;yes&#39;.&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://reportingservicestnt.blogspot.com/feeds/1061385155753646343/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://reportingservicestnt.blogspot.com/2012/08/conditional-page-breaks-in-ssrs-2008-r2.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/1061385155753646343'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/1061385155753646343'/><link rel='alternate' type='text/html' href='http://reportingservicestnt.blogspot.com/2012/08/conditional-page-breaks-in-ssrs-2008-r2.html' title='Conditional Page Breaks in SSRS 2008 r2'/><author><name>abs</name><uri>http://www.blogger.com/profile/08183235261376957091</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3581668942031605287.post-7575181749046068099</id><published>2012-05-08T12:52:00.000+01:00</published><updated>2018-03-21T23:07:13.621+00:00</updated><title type='text'>SQL Server Failed jobs in SSMS</title><content type='html'>&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;The following sql will list all the jobs that have failed in sql server:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;SELECT TOP 100 PERCENT &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Z.Originating_Server,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;msdb.dbo.sysjobhistory.message as Error_Message,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;len(msdb.dbo.sysjobhistory.message) as Error_Len&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;, &amp;nbsp; &amp;nbsp;msdb.dbo.sysjobs.name AS Job_Name&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; , msdb.dbo.sysjobhistory.step_id AS Step &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; , msdb.dbo.sysjobhistory.step_name AS Job_Step_Name&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; , (CASE&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;WHEN &amp;nbsp;msdb.dbo.sysjobhistory.run_status = 0 THEN &#39;Failed&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;WHEN &amp;nbsp;msdb.dbo.sysjobhistory.run_status = 1 &amp;nbsp;THEN &#39;Succeeded&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;WHEN &amp;nbsp;msdb.dbo.sysjobhistory.run_status = 2 &amp;nbsp;THEN &#39;Retry&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;WHEN &amp;nbsp;msdb.dbo.sysjobhistory.run_status = 3 &amp;nbsp;THEN &#39;Cancelled&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;WHEN &amp;nbsp;msdb.dbo.sysjobhistory.run_status = 4 &amp;nbsp;THEN &#39;In progress&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; END) &amp;nbsp;AS Status&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; , cast(&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;cast(msdb.dbo.sysjobhistory.run_date as varchar) + &#39; &#39; +&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; left(right(&#39;000000&#39; + cast(msdb.dbo.sysjobhistory.run_time as varchar), 6), 2) + &#39;:&#39; +&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; substring(right(&#39;000000&#39; + cast(msdb.dbo.sysjobhistory.run_time as varchar), 6), 3, 2) + &#39;:&#39; +&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;right(right(&#39;000000&#39; + cast(msdb.dbo.sysjobhistory.run_time as varchar), 6),2)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; as smallDatetime) &amp;nbsp;AS Date&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;, (SELECT DATENAME (dw, &amp;nbsp;(select convert (smalldatetime, convert (varchar(10), msdb.dbo.sysjobhistory.run_date))))) AS [Day]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; , (CASE&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;WHEN len(msdb.dbo.sysjobhistory.run_duration) = 6 THEN substring(cast(run_duration as char(6)),1,2)+&#39;:&#39;+substring(cast(run_duration as char(6)),3,2)+&#39;:&#39;+substring(cast(run_duration as char(6)),5,2)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;WHEN len(msdb.dbo.sysjobhistory.run_duration) = 5 THEN &#39;0&#39; +substring(cast(run_duration as char(5)),1,1)+&#39;:&#39;+substring(cast(run_duration as char(5)),2,2)+&#39;:&#39;+substring(cast(run_duration as char(5)),4,2) &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;WHEN len(msdb.dbo.sysjobhistory.run_duration) = 4 THEN &#39;00&#39;+&#39;:&#39;+substring(cast(run_duration as char(4)),1,2)+&#39;:&#39;+substring(cast(run_duration as char(4)),3,2) &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;WHEN len(msdb.dbo.sysjobhistory.run_duration) = 3 THEN &#39;00:0&#39;+substring(cast(run_duration as char(3)),1,1)+&#39;:&#39;+substring(cast(run_duration as char(3)),2,2) &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;WHEN len(msdb.dbo.sysjobhistory.run_duration) = 2 THEN &#39;00:00&#39;+&#39;:&#39;+substring(cast(run_duration as char(2)),1,2)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;WHEN len(msdb.dbo.sysjobhistory.run_duration) = 1 THEN &#39;00:00:0&#39;+substring(cast(run_duration as char(1)),1,1)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;ELSE &#39;00:00:00&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; END) &amp;nbsp; AS [Duration]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; , msdb.dbo.syscategories.name AS Job_Category&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;FROM msdb.dbo.sysjobs LEFT OUTER &amp;nbsp;JOIN msdb.dbo.sysjobhistory ON msdb.dbo.sysjobs.job_id = msdb.dbo.sysjobhistory.job_id&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;INNER JOIN msdb.dbo.syscategories ON msdb.dbo.sysjobs.category_id = msdb.dbo.syscategories.category_id&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;join &amp;nbsp;msdb.dbo.sysoriginatingservers_view &amp;nbsp;Z on z.originating_server_id = msdb.dbo.sysjobs.originating_server_id&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;WHERE&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;cast(&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cast(msdb.dbo.sysjobhistory.run_date as varchar) + &#39; &#39; +&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; left(right(&#39;000000&#39; + cast(msdb.dbo.sysjobhistory.run_time as varchar), 6), 2) + &#39;:&#39; +&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; substring(right(&#39;000000&#39; + cast(msdb.dbo.sysjobhistory.run_time as varchar), 6), 3, 2) + &#39;:&#39; +&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; right(right(&#39;000000&#39; + cast(msdb.dbo.sysjobhistory.run_time as varchar), 6),2)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; as smallDatetime) &amp;nbsp;&amp;gt; DATEADD(dd, - 1, current_timestamp )&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;AND &amp;nbsp;(msdb.dbo.sysjobhistory.step_id &amp;gt; 0)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;AND &amp;nbsp;(msdb.dbo.sysjobhistory.run_status &amp;lt;&amp;gt;1)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;ORDER BY&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;[Date] DESC&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://reportingservicestnt.blogspot.com/feeds/7575181749046068099/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://reportingservicestnt.blogspot.com/2012/05/sql-server-failed-jobs-in-ssms.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/7575181749046068099'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/7575181749046068099'/><link rel='alternate' type='text/html' href='http://reportingservicestnt.blogspot.com/2012/05/sql-server-failed-jobs-in-ssms.html' title='SQL Server Failed jobs in SSMS'/><author><name>abs</name><uri>http://www.blogger.com/profile/08183235261376957091</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3581668942031605287.post-7374584167095848500</id><published>2012-05-08T12:48:00.001+01:00</published><updated>2018-03-21T23:07:33.985+00:00</updated><title type='text'>CTEs</title><content type='html'>&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;For Dates in a calendar style report you could use the following to generate the dates.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;with mycte as&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;( select cast(&#39;2012-01-01&#39; as datetime) DateValue&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; union all&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; select DateValue + 1&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; from &amp;nbsp; &amp;nbsp;mycte &amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;where &amp;nbsp; DateValue + 1 &amp;lt; getdate())&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;-- select DateValue&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;-- from &amp;nbsp; &amp;nbsp;mycte&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;--OPTION (MAXRECURSION 0)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;select DateValue,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Year(DateValue) as Year, &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;DATEPART(Quarter ,DateValue) as Quarter,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;DATENAME( month,DateValue) as MonthName,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;DATEPART(m ,DateValue) &amp;nbsp;as MonthNo,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;day (DateValue) as Day&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;from &amp;nbsp; &amp;nbsp;mycte&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;OPTION (MAXRECURSION 0)&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://reportingservicestnt.blogspot.com/feeds/7374584167095848500/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://reportingservicestnt.blogspot.com/2012/05/ctes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/7374584167095848500'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/7374584167095848500'/><link rel='alternate' type='text/html' href='http://reportingservicestnt.blogspot.com/2012/05/ctes.html' title='CTEs'/><author><name>abs</name><uri>http://www.blogger.com/profile/08183235261376957091</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3581668942031605287.post-3511389915337247294</id><published>2012-04-17T16:15:00.000+01:00</published><updated>2018-03-21T23:08:04.253+00:00</updated><title type='text'>Failed Subscriptions</title><content type='html'>&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;From time to time reports fail and you need know about them so that they can be sent to the relevant recipients without any delay. The script below has been used to create a report with data driven subscription.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;SELECT &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&#39;Failed Subscriptions&#39; as Type,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;convert(char(40),c.path) as Folder_Path,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;c.name as Report_Name,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;case when len(convert(char(8000),parameters)) =19 then &#39;No Parameters&#39; else &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;convert(char(700),parameters) end as parameters,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;s.description as Recipients,s.lastruntime,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;convert(char(500),laststatus) as Error,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&#39;PathName&#39; + replace(replace(c.path,&#39;/&#39;,&#39;%2f&#39;),&#39; &#39;,&#39;+&#39;) + &#39;&amp;amp;ViewMode=Detail&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;as [ReportURL],&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&#39;Pathname&#39; + replace(replace(c.path,&#39;/&#39;,&#39;%2f&#39;),&#39; &#39;,&#39;+&#39;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;+ &#39;&amp;amp;SelectedTabId=PropertiesTab&amp;amp;ViewMode=Detail&amp;amp;SelectedSubTabId=SubscriptionsTab&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;as [SubsURL],&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;right(UserName,len(username)-12) as created_by,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;case when s1.eventtype &amp;lt;&amp;gt;&#39;SharedSchedule&#39; then &#39;ReportSpecific&#39; else s1.Name end as Schedule_Name&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;from subscriptions s&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;join catalog c on s.report_oid=c.itemid&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;join users u on s.ownerid = u.userid&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;LEFT OUTER join reportschedule rs on rs.subscriptionid = s.subscriptionid &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;LEFT OUTER join schedule s1 on s1.scheduleid = rs.scheduleid &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;where &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;(laststatus like &#39;%fail%&#39; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;or LastStatus like &#39;error:%&#39;)&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://reportingservicestnt.blogspot.com/feeds/3511389915337247294/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://reportingservicestnt.blogspot.com/2012/04/failed-subscriptions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/3511389915337247294'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/3511389915337247294'/><link rel='alternate' type='text/html' href='http://reportingservicestnt.blogspot.com/2012/04/failed-subscriptions.html' title='Failed Subscriptions'/><author><name>abs</name><uri>http://www.blogger.com/profile/08183235261376957091</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3581668942031605287.post-7734244199921389099</id><published>2011-10-28T15:32:00.004+01:00</published><updated>2018-03-21T23:08:41.107+00:00</updated><title type='text'>Action Go to URL</title><content type='html'>&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;To open a mail message from a textbox you can use the following URL in the action box of the text.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;mailto:user@gmail.com?subject=This%20is%20an%20email%20test&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;To open a webpage in a new page &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;=&quot;javascript:void(window.open(&#39;&quot;+ &quot;http://www.bbc.co.uk&quot; + &quot;&#39;,&#39;_blank&#39;))&quot;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;In the report viewer there is no back button which will take tyou back to your original report. What you can do is create your own textbox which you use the action function to take you back to the main report. This refreshes the original report, you can use the following URL and this will take you back to the main report whithout refereshing it.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;javascript:history.back(1)&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://reportingservicestnt.blogspot.com/feeds/7734244199921389099/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://reportingservicestnt.blogspot.com/2011/10/action-go-to-url.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/7734244199921389099'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/7734244199921389099'/><link rel='alternate' type='text/html' href='http://reportingservicestnt.blogspot.com/2011/10/action-go-to-url.html' title='Action Go to URL'/><author><name>abs</name><uri>http://www.blogger.com/profile/08183235261376957091</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3581668942031605287.post-3291928847919160008</id><published>2011-09-29T11:51:00.002+01:00</published><updated>2011-12-23T09:52:33.664+00:00</updated><title type='text'>T sql Scripts</title><content type='html'>Here are some scripts which I use now and then, it is quite useful to have these handy.&lt;br /&gt;&lt;br /&gt;--- percentage Calculation returns zero&lt;br /&gt;select (43/50) * 100&lt;br /&gt;&lt;br /&gt;---percentage calculation where you cast the values&lt;br /&gt;select cast(43 as float)/cast(50 as float)*100&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;---percentage calculation &lt;br /&gt;---with 2 decimal places&lt;br /&gt;select convert(decimal(10,2),cast(43 as float)/cast(50 as float)*100)&lt;br /&gt;&lt;br /&gt;---Date Scripts&lt;br /&gt;&lt;br /&gt;select  datepart(d,getdate())  --returns day number&lt;br /&gt;select  datepart(dw,getdate()) --returns day of week, day 1 = Sunday and 7 = Saturday&lt;br /&gt;&lt;br /&gt;select datename(month,GETDATE())   --retunrs Month Name&lt;br /&gt;select left(datename(month,GETDATE()),3)  --returns first 3 letters of Month Name&lt;br /&gt;&lt;br /&gt;select datename(WEEKDAY,GETDATE())    --returns Day Name&lt;br /&gt;select left(datename(WEEKDAY,GETDATE()),3) --returns first 3 letters of Day Name</content><link rel='replies' type='application/atom+xml' href='http://reportingservicestnt.blogspot.com/feeds/3291928847919160008/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://reportingservicestnt.blogspot.com/2011/09/t-sql-scripts.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/3291928847919160008'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/3291928847919160008'/><link rel='alternate' type='text/html' href='http://reportingservicestnt.blogspot.com/2011/09/t-sql-scripts.html' title='T sql Scripts'/><author><name>abs</name><uri>http://www.blogger.com/profile/08183235261376957091</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3581668942031605287.post-1053404763796489563</id><published>2011-09-29T09:23:00.003+01:00</published><updated>2018-03-21T23:08:27.194+00:00</updated><title type='text'>Alternate Colors in a Matrix/Pivot Table</title><content type='html'>&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;To add alternate colors in a matrix the expression should be as follows for the row group:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;=IIf( RunningValue (Fields!FIELDNAME.Value, CountDistinct, Nothing) MOD 2, &quot;Transparent&quot;, &quot;aliceblue&quot;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;The tricky bit is when you want the same shading for the column groups. The way to do this is to insert a column outside of the row group and then use the same expression. Change the name of the textbox to &quot;color&quot;. Then in your column group or data field in your matrix in the background color insert the expression which refers to the textbox &quot;color&quot;:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;=Reportitems!color.value&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;The colors in the matrix will alternate like a normal table.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Wahayy!!&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Also in a anormal table where you have multiple groups you can use the following script for say 2 groups I assume you just use &#39;&amp;amp;&#39; and add in the extra fields if you have more than one group:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;=IIF(RunningValue(Fields!Field1.Value &amp;amp; Fields!Field2.Value,CountDistinct, Nothing) MOD 2 = 1, &quot;White&quot;, &quot;Aliceblue&quot;)&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://reportingservicestnt.blogspot.com/feeds/1053404763796489563/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://reportingservicestnt.blogspot.com/2011/09/alternate-colors-in-matrixpivot-table.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/1053404763796489563'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/1053404763796489563'/><link rel='alternate' type='text/html' href='http://reportingservicestnt.blogspot.com/2011/09/alternate-colors-in-matrixpivot-table.html' title='Alternate Colors in a Matrix/Pivot Table'/><author><name>abs</name><uri>http://www.blogger.com/profile/08183235261376957091</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3581668942031605287.post-85458811167054432</id><published>2011-06-15T17:00:00.001+01:00</published><updated>2018-03-21T23:08:55.425+00:00</updated><title type='text'>Expressions - Following Monday</title><content type='html'>&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;=DateAdd(&quot;d&quot;,(8-Weekday(today(),0)),today())&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;The above expression will return the following Monday from Todays Date.&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://reportingservicestnt.blogspot.com/feeds/85458811167054432/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://reportingservicestnt.blogspot.com/2011/06/expressions-following-monday.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/85458811167054432'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/85458811167054432'/><link rel='alternate' type='text/html' href='http://reportingservicestnt.blogspot.com/2011/06/expressions-following-monday.html' title='Expressions - Following Monday'/><author><name>abs</name><uri>http://www.blogger.com/profile/08183235261376957091</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3581668942031605287.post-1391828678719092320</id><published>2010-10-26T10:18:00.000+01:00</published><updated>2010-10-27T12:19:02.894+01:00</updated><title type='text'>Exporting to Excel and renaming sheets in 2008 R2</title><content type='html'>In Reporting Services 2008 R2 Microsoft has added functionality to rename multiple sheets, so if your report is more than one page and you want to rename the worksheets this will work automatically out of the box.&lt;br /&gt;&lt;br /&gt;You can either rename the sheets for a group, if each group has a page break between them or you can rename sheets if there is page break between objects.&lt;br /&gt;&lt;br /&gt;To rename sheets in a table with groups all you have to do is select the group as shown below and then in the properties window (press F4 if the properties window is not shown) change the setting for pagename under the Group section to the value you want. This could be text or a field from your dataset.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCJjsq-wIOtJeA_z_2Msz37L0e3hKUGtSi9xlKpzhyYyomJJtxtZhlsb7E1BuwfamRPdDg67HR6EOXsJG0LyxvbSlLYonPvQTX2uQqtxfQJi4eWKTCgcE8Ffs4kIUdBuA8mauRqC7bCA/s1600/Rename+sheets.GIF&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5532672857026418354&quot; style=&quot;WIDTH: 320px; CURSOR: hand; HEIGHT: 234px&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCJjsq-wIOtJeA_z_2Msz37L0e3hKUGtSi9xlKpzhyYyomJJtxtZhlsb7E1BuwfamRPdDg67HR6EOXsJG0LyxvbSlLYonPvQTX2uQqtxfQJi4eWKTCgcE8Ffs4kIUdBuA8mauRqC7bCA/s320/Rename+sheets.GIF&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The export to excel will rename the sheets with the group name.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZS2Iyn-dMJ8SW5yVS3I-SM7yw0s3jxXGl0JvLgJjiXvLOO4s1mU5x8y__l7cYHnCVtePGUvUB9dP-4l4G7_lW-ExNxBMppuQ0YLLnLHSYlfKb5NdkCXFA7_ndpevUZSeA7o4fh5A3Wg/s1600/excel.GIF&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;width: 320px; height: 238px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZS2Iyn-dMJ8SW5yVS3I-SM7yw0s3jxXGl0JvLgJjiXvLOO4s1mU5x8y__l7cYHnCVtePGUvUB9dP-4l4G7_lW-ExNxBMppuQ0YLLnLHSYlfKb5NdkCXFA7_ndpevUZSeA7o4fh5A3Wg/s320/excel.GIF&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5532674665668005154&quot; /&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://reportingservicestnt.blogspot.com/feeds/1391828678719092320/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://reportingservicestnt.blogspot.com/2010/10/exporting-to-excel-and-renaming-sheets_26.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/1391828678719092320'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/1391828678719092320'/><link rel='alternate' type='text/html' href='http://reportingservicestnt.blogspot.com/2010/10/exporting-to-excel-and-renaming-sheets_26.html' title='Exporting to Excel and renaming sheets in 2008 R2'/><author><name>abs</name><uri>http://www.blogger.com/profile/08183235261376957091</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCJjsq-wIOtJeA_z_2Msz37L0e3hKUGtSi9xlKpzhyYyomJJtxtZhlsb7E1BuwfamRPdDg67HR6EOXsJG0LyxvbSlLYonPvQTX2uQqtxfQJi4eWKTCgcE8Ffs4kIUdBuA8mauRqC7bCA/s72-c/Rename+sheets.GIF" height="72" width="72"/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3581668942031605287.post-1155280874097258500</id><published>2010-10-26T09:59:00.000+01:00</published><updated>2010-10-26T10:18:24.199+01:00</updated><title type='text'>Exporting to Excel and renaming sheets in 2005</title><content type='html'>In Reporting Services 2005 there was no functionality to rename sheets when your report was more than one page. You had to either use custom code to rename the sheets or use a macro. &lt;br /&gt;&lt;br /&gt;We created a field in one of the cells in the report and then changed the font colour to white, then we created a macro to copy the value in the cell and rename the sheets. The macro is shown below:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Sub RenameSheets()&lt;br /&gt;&#39; Renames all the sheets based on the contents of the cell A1&lt;br /&gt;&#39; If the cell A1 is empty the sheet will be renamed and there is a limit of 31 characters if this is exceeded then only the first 31 are used&lt;br /&gt;&#39; If the following characters are used then an error will be returned:&lt;br /&gt;&#39; []?*/\:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Dim i As Integer&lt;br /&gt;&lt;br /&gt;For i = 1 To Sheets.Count&lt;br /&gt;&lt;br /&gt;If (Len(Worksheets(i).Range(&quot;A2&quot;).Value) &lt; 32) Then&lt;br /&gt;If (Len(Worksheets(i).Range(&quot;A2&quot;).Value) &gt; 0) Then&lt;br /&gt;Sheets(i).Name = Worksheets(i).Range(&quot;A2&quot;).Value&lt;br /&gt;End If&lt;br /&gt;Else&lt;br /&gt;Sheets(i).Name = Left(Worksheets(i).Range(&quot;A2&quot;).Value, 31)&lt;br /&gt;End If&lt;br /&gt;Next&lt;br /&gt;End Sub&lt;/em&gt;</content><link rel='replies' type='application/atom+xml' href='http://reportingservicestnt.blogspot.com/feeds/1155280874097258500/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://reportingservicestnt.blogspot.com/2010/10/exporting-to-excel-and-renaming-sheets.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/1155280874097258500'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/1155280874097258500'/><link rel='alternate' type='text/html' href='http://reportingservicestnt.blogspot.com/2010/10/exporting-to-excel-and-renaming-sheets.html' title='Exporting to Excel and renaming sheets in 2005'/><author><name>abs</name><uri>http://www.blogger.com/profile/08183235261376957091</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3581668942031605287.post-6547717345854354864</id><published>2010-10-25T17:29:00.001+01:00</published><updated>2010-10-25T17:30:44.802+01:00</updated><title type='text'>New Line in a Text Box</title><content type='html'>In a text box field you can use the following code to force reporting services to start a next line.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&#39;This the first line&#39;+ VBCRLF +&lt;br /&gt;&#39;This is the second line&#39;+ VBCRLF +&lt;br /&gt;&#39;This is the third&#39;</content><link rel='replies' type='application/atom+xml' href='http://reportingservicestnt.blogspot.com/feeds/6547717345854354864/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://reportingservicestnt.blogspot.com/2010/10/new-line-in-text-box.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/6547717345854354864'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/6547717345854354864'/><link rel='alternate' type='text/html' href='http://reportingservicestnt.blogspot.com/2010/10/new-line-in-text-box.html' title='New Line in a Text Box'/><author><name>abs</name><uri>http://www.blogger.com/profile/08183235261376957091</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3581668942031605287.post-2961441678523545098</id><published>2010-10-25T12:15:00.003+01:00</published><updated>2018-03-21T23:11:01.018+00:00</updated><title type='text'>Subscriptions SQL query</title><content type='html'>&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Due to the fact the reporting services allows you to query the tables you can easily write SQL which will allow you to return data from the reportserver database.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;The script below specifically looks at the subscriptions table which can be created into a report with filters. It is quite handy when you have hundreds of subscriptions to easily find the one you are looking for.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Also as some developers will chose to create specific report subscriptions rather than use shared schedules it can be difficult to work out when they will be sent.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;The way that the fields for the report specific times are stored is&amp;nbsp;basically&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;1,2,4,8,16 etc for example for the day of the week field &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;1 is Sunday, 2 is Monday, 4 is Tuesday, 8 is Wednesday etc &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;All the fields are coded like this so it may be best to look at all the distinct values and then work out all the coding in your case statements.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;The script will work for both reporting services 2005 and 2008 R2&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Enjoy!!&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;select &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;case when parameters like &#39;&#39; then &#39;No Parameters&#39; else &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;parameters end as Para,substring(path,2,50) as path_link,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;recipients+&#39; - &#39;+cc+&#39; - &#39;+bcc as AllRecipients,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;* from (&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;SELECT &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;month as month2,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;case &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when recurrencetype = 1 then &#39;One off&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when recurrencetype = 2 then &#39;Hour&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when recurrencetype = 4 then &#39;daily&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when recurrencetype = 5 then &#39;monthly&#39; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when recurrencetype = 6 then &#39;month Week&#39; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;end as Typ,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;case when daysofmonth = 1 then &#39;1&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 2 then &#39;2&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 4 then &#39;3&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 8 then &#39;4&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 16 then &#39;5&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 32 then &#39;6&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 64 then &#39;7&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 128 then &#39;8&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 256 then &#39;9&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 512 then &#39;10&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 1024 then &#39;11&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 2048 then &#39;12&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 4096 then &#39;13&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 8192 then &#39;14&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 16384 then &#39;15&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 32768 then &#39;16&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 65536 then &#39;17&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 131072 then &#39;18&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 262144 then &#39;19&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 524288 then &#39;20&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 1048576 then &#39;21&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 2097152 then &#39;22&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 4194304 then &#39;23&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 8388608 then &#39;24&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 16777216 then &#39;25&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 33554432 then &#39;26&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 67108864 then &#39;27&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 134217728 then &#39;28&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 268435456 then &#39;29&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 536870912 then &#39;30&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 1073741824 then &#39;31&#39; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when daysofmonth = 8193 then &#39;1st and 14th day&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;end as daysofmonth,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;case &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when Month = 4095 then &#39;All Months&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when MONTH = 585 then &#39;Jan,April,July,October&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when Month = 1 then &#39;Jan&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when Month = 2 then &#39;Feb&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when Month = 4 then &#39;Mar&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when Month = 8 then &#39;Apr&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when Month = 16 then &#39;May&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when Month = 32 then &#39;Jun&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when Month = 64 then &#39;Jul&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when Month = 128 then &#39;Aug&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when Month = 256 then &#39;Sep&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when Month = 512 then &#39;Oct&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when Month = 1024 then &#39;Nov&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;when Month = 2048 then &#39;Dec&#39; end as Month,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;isnull(MinutesInterval,0) AS MinutesInterval,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;case when isnull(MinutesInterval,0) &lt;60 --right=&quot;&quot; 0=&quot;&quot; alue=&quot;&quot; ame=&quot;&quot; and=&quot;&quot; arametervalue=&quot;&quot; arametervalues=&quot;&quot; as=&quot;&quot; at=&quot;&quot; bcc=&quot;&quot; c.description=&quot;&quot; c.name=&quot;&quot; c.path=&quot;&quot; case=&quot;&quot; cc=&quot;&quot; createdby=&quot;&quot; days=&quot;&quot; daysofweek=&quot;&quot; ed=&quot;&quot; else=&quot;&quot; end=&quot;&quot; extensionsettings=&quot;&quot; hours=&quot;&quot; hu=&quot;&quot; left=&quot;&quot; len=&quot;&quot; ll=&quot;&quot; minutesinterval=&quot;&quot; modifiedby=&quot;&quot; on-fri=&quot;&quot; on=&quot;&quot; parameters=&quot;&quot; query=&quot;&quot; recipients=&quot;&quot; replace=&quot;&quot; report_description=&quot;&quot; report_name=&quot;&quot; ri=&quot;&quot; right=&quot;&quot; s1.eventtype=&quot;&quot; subs.description=&quot;&quot; subs.lastruntime=&quot;&quot; subs.laststatus=&quot;&quot; subs.modifieddate=&quot;&quot; subs.subscriptionid=&quot;&quot; then=&quot;&quot; to=&quot;&quot; u.username=&quot;&quot; u1.username=&quot;&quot; ue=&quot;&quot; un=&quot;&quot; varchar=&quot;&quot; wed=&quot;&quot; when=&quot;&quot; xml=&quot;&quot;&gt;&#39;SharedSchedule&#39; then &#39;ReportSpecific&#39; else s1.Name end as Schedule_Name,&lt;br /&gt;
s1.startdate,s1.nextruntime,s1.eventtype,subs.description as [Subscription Description]&lt;br /&gt;
FROM&lt;br /&gt;
ReportServer.dbo.Subscriptions subs with(nolock)&lt;br /&gt;
join catalog c on c.itemid = subs.report_oid&lt;br /&gt;
join users u on u.userid = subs.modifiedbyid&lt;br /&gt;
join users u1 on u1.userid = subs.ownerid&lt;br /&gt;
join reportschedule rs on rs.subscriptionid = subs.subscriptionid &lt;br /&gt;
join schedule s1 on s1.scheduleid = rs.scheduleid &lt;br /&gt;
) as D&lt;/60&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://reportingservicestnt.blogspot.com/feeds/2961441678523545098/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://reportingservicestnt.blogspot.com/2010/10/subscriptions-sql.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/2961441678523545098'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/2961441678523545098'/><link rel='alternate' type='text/html' href='http://reportingservicestnt.blogspot.com/2010/10/subscriptions-sql.html' title='Subscriptions SQL query'/><author><name>abs</name><uri>http://www.blogger.com/profile/08183235261376957091</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3581668942031605287.post-8002978339919621494</id><published>2010-10-21T12:14:00.000+01:00</published><updated>2010-10-21T14:17:42.119+01:00</updated><title type='text'>Sending reports using SQL</title><content type='html'>&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6RugzyiA0DCoanf4hSbgb4OJ0n4KRtYbERGa-J_HRVkuvBDeVcdgAyF04OsEAz2AwXhYOBjkEhiNEGJM6pf54lv1lmqVaCJWPqamRLaRSYC9UVqo1KBmkNSSGnBFdNfo_33MDkdNQjw/s1600/My_Schedule.bmp&quot;&gt;&lt;img style=&quot;float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 307px; height: 320px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6RugzyiA0DCoanf4hSbgb4OJ0n4KRtYbERGa-J_HRVkuvBDeVcdgAyF04OsEAz2AwXhYOBjkEhiNEGJM6pf54lv1lmqVaCJWPqamRLaRSYC9UVqo1KBmkNSSGnBFdNfo_33MDkdNQjw/s320/My_Schedule.bmp&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5530463760177844594&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Sometimes there may be a requirement to send a report using sql code or you may be fed up with having to change the time in report manager when you are develping a report.&lt;br /&gt;&lt;br /&gt;1)The first step would be to create a shared schedule which is in the past&lt;br /&gt;and give it a name eg My_schedule&lt;br /&gt;see the screenshot for details.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In the reportserver database you will need to create a stored procedure which will allow you to do this but first you will need to create a Synonym to the schedule table. My understanding is that a synonym is normally used to save you time writing an object name if its on a different server, eg if you want to refer to a table called customers which was on a different server you would type &lt;br /&gt;[servername].[databasename].dbo.customers&lt;br /&gt;you can create a synoynm which will allow you to refer to this object without having to type the full name&lt;br /&gt;2)create synonym dbo.mycutomers for [servername].[databasename].dbo.customers&lt;br /&gt;&lt;br /&gt;So first create synonym for the schedule table on the reportserver database&lt;br /&gt;&lt;br /&gt;create synonym dbo.runreportschedule for [servername].[databasename].dbo.schedule&lt;br /&gt;&lt;br /&gt;Then create a store procedure which will fire the report schedule&lt;br /&gt;3)&lt;br /&gt;CREATE  PROC [dbo].Runreportschedule(@EventName AS NVARCHAR(1000))&lt;br /&gt; as&lt;br /&gt; DECLARE @myScheduleID AS NVARCHAR(1000)&lt;br /&gt; SELECT&lt;br /&gt;   @myScheduleID=s.ScheduleID&lt;br /&gt; FROM&lt;br /&gt;   dbo.dbo.runreportschedule AS s&lt;br /&gt; WHERE&lt;br /&gt;  NAME = @EventName&lt;br /&gt;EXEC msdb..sp_start_job @job_name =@myScheduleID&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You will need to give the system prcoedure sp_start_job permissions so that it can fire the report.&lt;br /&gt;&lt;br /&gt;Everything is now set, All you need to do is create a subscription on report manager and then use the shared schedule you have created.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiw8G8H_DXYePaKx7JyP_nYmHE4Cs0F7imDQ-wM-yXSMwf_OU5AHuYBIAKJnxPupeuiz5TkurF9bPev0-LCfiAq7a1RS9G7VFVMJ1PnK4zymoOnLapkejhpEKT8emRI6WhfaZdNcMOvuw/s1600/report+schedule.bmp&quot;&gt;&lt;img style=&quot;float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 239px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiw8G8H_DXYePaKx7JyP_nYmHE4Cs0F7imDQ-wM-yXSMwf_OU5AHuYBIAKJnxPupeuiz5TkurF9bPev0-LCfiAq7a1RS9G7VFVMJ1PnK4zymoOnLapkejhpEKT8emRI6WhfaZdNcMOvuw/s320/report+schedule.bmp&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5530467320416328162&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Then in query analyser execute the stored procedure &lt;br /&gt;&lt;br /&gt;[dbo].Runreportschedule &#39;Myschedule&#39;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This will then send the report immediately</content><link rel='replies' type='application/atom+xml' href='http://reportingservicestnt.blogspot.com/feeds/8002978339919621494/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://reportingservicestnt.blogspot.com/2010/10/sending-reports-using-sql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/8002978339919621494'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/8002978339919621494'/><link rel='alternate' type='text/html' href='http://reportingservicestnt.blogspot.com/2010/10/sending-reports-using-sql.html' title='Sending reports using SQL'/><author><name>abs</name><uri>http://www.blogger.com/profile/08183235261376957091</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6RugzyiA0DCoanf4hSbgb4OJ0n4KRtYbERGa-J_HRVkuvBDeVcdgAyF04OsEAz2AwXhYOBjkEhiNEGJM6pf54lv1lmqVaCJWPqamRLaRSYC9UVqo1KBmkNSSGnBFdNfo_33MDkdNQjw/s72-c/My_Schedule.bmp" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3581668942031605287.post-4788331385096728039</id><published>2010-10-21T11:35:00.001+01:00</published><updated>2018-03-21T23:16:56.426+00:00</updated><title type='text'>T SQL Functions</title><content type='html'>&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;T SQL Function which returns the date for the previous month, the date is required in 2 digits&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;select dbo.fnlastmonthdate(27)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;result&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;2010-09-27 00:00:00&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;create FUNCTION [dbo].[fnlastmonthdate] (@day int)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;returns smalldatetime&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;as&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;BEGIN&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;RETURN &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;--select  &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;cast (&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;convert(char(4),case when datepart(mm,getdate())=12 then datepart(yy,getdate())-1 else datepart(yy,getdate()) end) &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;+&#39;-&#39;+&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;CASE WHEN len (case when datepart(mm,getdate())=12 then 1 else datepart(mm,getdate())-1 end) = 1 THEN &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&#39;0&#39;+convert(char(1),case when datepart(mm,getdate())=12 then 1 else datepart(mm,getdate())-1 end) ELSE &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;convert(char(2),case when datepart(mm,getdate())=12 then 1 else datepart(mm,getdate())-1 end)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;END&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;+ &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&#39;-&#39;+convert(char(2),@day)+ &#39; 00:00:00.000&#39; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;as smalldatetime)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;END&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;GO&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://reportingservicestnt.blogspot.com/feeds/4788331385096728039/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://reportingservicestnt.blogspot.com/2010/10/t-sql-functions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/4788331385096728039'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/4788331385096728039'/><link rel='alternate' type='text/html' href='http://reportingservicestnt.blogspot.com/2010/10/t-sql-functions.html' title='T SQL Functions'/><author><name>abs</name><uri>http://www.blogger.com/profile/08183235261376957091</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3581668942031605287.post-818986785246819459</id><published>2010-05-12T12:22:00.000+01:00</published><updated>2018-03-21T23:11:54.362+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SSRS Expressions"/><title type='text'>SSRS Expressions</title><content type='html'>&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;To Alternate colours for a group:&lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;=iif(RunningValue(Fields!MYFIELD.Value,countdistinct,nothing) mod 2,&quot;silver&quot;,&quot;white&quot;)&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;To Concatenate a String with a date value:&lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;=&quot;Today is the day &quot;+FormatDateTime(fields!MYDATE.Value)&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;To create a &#39;Page N of M&#39; Expression:&lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;=&quot;Page &quot; &amp;amp; Globals.PageNumber &amp;amp; &quot; of &quot; &amp;amp; Globals.TotalPages&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Concatenating a string with a currency value and removing the decimal places&lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;=&quot;The current price of bread is : &quot;+cstr(FormatCurrency(Fields!MYFIELD.Value,0))&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Switch Expression Example works like a case statement in sql &lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;=SWITCH(Fields!status_code.Value = &quot;OPEN&quot;, &quot;chartreuse&quot;,&lt;br /&gt;fields!status_code.Value =  &quot;OPENA&quot;, &quot;chartresuse&quot;,&lt;br /&gt;fields!status_code.Value = &quot;OPENC&quot;, &quot;chartreuse&quot;,&lt;br /&gt;fields!status_code.Value = &quot;CLOSE&quot;,&quot;Gainsboro&quot;,&lt;br /&gt;fields!status_code.Value = &quot;ARCHI&quot;,&quot;Gainsboro&quot;,&lt;br /&gt;TRUE,&quot;yellow&quot;)&lt;/span&gt;&lt;/strong&gt;</content><link rel='replies' type='application/atom+xml' href='http://reportingservicestnt.blogspot.com/feeds/818986785246819459/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://reportingservicestnt.blogspot.com/2010/05/ssrs-expressions.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/818986785246819459'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/818986785246819459'/><link rel='alternate' type='text/html' href='http://reportingservicestnt.blogspot.com/2010/05/ssrs-expressions.html' title='SSRS Expressions'/><author><name>abs</name><uri>http://www.blogger.com/profile/08183235261376957091</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3581668942031605287.post-3083061738074712125</id><published>2010-01-25T15:48:00.000+00:00</published><updated>2018-03-21T23:11:40.623+00:00</updated><title type='text'>Custom Colours in Pie Charts</title><content type='html'>&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh43buEh1QOTUpL5FiOlsDWijupc6FQl9itr0O2L4ArHA8h5sLYjcxKefBqsxKMeIHYbIonIp2rEGed98bc8Zk_OBOjrhLhVN_HGmhAJcM_FCu5ZZNz1KbweBeMnjbn0dgeQ0xfwA5mHw/s1600-h/custom+code.bmp&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5430717449407896882&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh43buEh1QOTUpL5FiOlsDWijupc6FQl9itr0O2L4ArHA8h5sLYjcxKefBqsxKMeIHYbIonIp2rEGed98bc8Zk_OBOjrhLhVN_HGmhAJcM_FCu5ZZNz1KbweBeMnjbn0dgeQ0xfwA5mHw/s320/custom+code.bmp&quot; style=&quot;cursor: hand; cursor: pointer; float: left; height: 247px; margin: 0 10px 10px 0; width: 320px;&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;I created a number of pie charts which compared the data for a number of clients in different years. As some of the clients did not have any data in some of the years the default colours were mixed up. &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;To remedy this you can use the code below to specify the colours you want.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;The code below is inserted in the report properties window under the code tab.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
Private colorPalette As String() = { &quot;purple&quot;,&quot;blue&quot;,&quot;darkgreen&quot;,&quot;lightgreen&quot;,&quot;pink&quot;,&quot;teal&quot;,&quot;yellow&quot;,&quot;gray&quot;,&quot;black&quot;}&lt;br /&gt;
Private count As Integer = 0&lt;br /&gt;
&lt;br /&gt;
Private mapping As New System.Collections.Hashtable()&lt;br /&gt;
&lt;br /&gt;
Public Function GetColor(ByVal groupingValue As String) As String&lt;br /&gt;
If mapping.ContainsKey(groupingValue) Then&lt;br /&gt;
Return mapping(groupingValue)&lt;br /&gt;
End If&lt;br /&gt;
Dim c As String = colorPalette(count Mod colorPalette.Length)&lt;br /&gt;
count = count + 1&lt;br /&gt;
mapping.Add(groupingValue, c)&lt;br /&gt;
Return c&lt;br /&gt;
End Function&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;You can choose the colours you want in between the brackets the order is from let to right.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;{ &quot;purple&quot;,&quot;blue&quot;,&quot;darkgreen&quot;,&quot;lightgreen&quot;,&quot;pink&quot;,&quot;teal&quot;,&quot;yellow&quot;,&quot;gray&quot;,&quot;black&quot;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;When you have entered the code you can use this in your pie chart. &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Edit the value in the data tab of your chart properties then edit the value, appearance,series style, fill, color and then click on the expression box and enter the following expression &lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;=Code.GetColor(Fields!.YOURFIELD.Value)&lt;/span&gt;&lt;/strong&gt;</content><link rel='replies' type='application/atom+xml' href='http://reportingservicestnt.blogspot.com/feeds/3083061738074712125/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://reportingservicestnt.blogspot.com/2010/01/custom-colours-in-pie-charts.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/3083061738074712125'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/3083061738074712125'/><link rel='alternate' type='text/html' href='http://reportingservicestnt.blogspot.com/2010/01/custom-colours-in-pie-charts.html' title='Custom Colours in Pie Charts'/><author><name>abs</name><uri>http://www.blogger.com/profile/08183235261376957091</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh43buEh1QOTUpL5FiOlsDWijupc6FQl9itr0O2L4ArHA8h5sLYjcxKefBqsxKMeIHYbIonIp2rEGed98bc8Zk_OBOjrhLhVN_HGmhAJcM_FCu5ZZNz1KbweBeMnjbn0dgeQ0xfwA5mHw/s72-c/custom+code.bmp" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3581668942031605287.post-6223946600316669229</id><published>2010-01-25T15:38:00.001+00:00</published><updated>2010-01-25T15:43:31.123+00:00</updated><title type='text'>Page Layout in Landscape Mode</title><content type='html'>&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-cE6pCBDgqSi9M9y1fzZlY8-KhIzsN0wJA6jedlOkUhgPeitp0JXXEFPgmiTiHETSkv9b67rAgQ3Hes_0gnPQiQgAqLrr6o5gfy3RTyNhjj59wqmVuMIGO7LfAhjgx0Q5uqgKjxy4wQ/s1600-h/report+properties.bmp&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;width: 320px; height: 256px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-cE6pCBDgqSi9M9y1fzZlY8-KhIzsN0wJA6jedlOkUhgPeitp0JXXEFPgmiTiHETSkv9b67rAgQ3Hes_0gnPQiQgAqLrr6o5gfy3RTyNhjj59wqmVuMIGO7LfAhjgx0Q5uqgKjxy4wQ/s320/report+properties.bmp&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5430703513911079218&quot; /&gt;&lt;/a&gt;&lt;br /&gt;I have quite a few requests to create reports in landscape format.&lt;br /&gt;In the report properties window change the page width to &lt;strong&gt;29.6cm&lt;/strong&gt;&lt;br /&gt;and the page height to &lt;strong&gt;21cm&lt;/strong&gt; and set the margins to &lt;strong&gt;1cm&lt;/strong&gt;.</content><link rel='replies' type='application/atom+xml' href='http://reportingservicestnt.blogspot.com/feeds/6223946600316669229/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://reportingservicestnt.blogspot.com/2010/01/page-layout-in-landscape-mode.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/6223946600316669229'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/6223946600316669229'/><link rel='alternate' type='text/html' href='http://reportingservicestnt.blogspot.com/2010/01/page-layout-in-landscape-mode.html' title='Page Layout in Landscape Mode'/><author><name>abs</name><uri>http://www.blogger.com/profile/08183235261376957091</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-cE6pCBDgqSi9M9y1fzZlY8-KhIzsN0wJA6jedlOkUhgPeitp0JXXEFPgmiTiHETSkv9b67rAgQ3Hes_0gnPQiQgAqLrr6o5gfy3RTyNhjj59wqmVuMIGO7LfAhjgx0Q5uqgKjxy4wQ/s72-c/report+properties.bmp" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3581668942031605287.post-4119022710938900060</id><published>2010-01-25T15:27:00.001+00:00</published><updated>2011-09-29T09:23:30.751+01:00</updated><title type='text'>Alternating colours</title><content type='html'>How to use alternating colours in a table created in ssrs&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Highlight the row or the cell in the details section of your report and then in the properties window in background (under Appearance). Select the Expression and in the Expression box&lt;br /&gt;type in the following code.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;=iif(RowNumber(Nothing) Mod 2, &quot;silver&quot;, &quot;White&quot;)&lt;br /&gt;=iif(RowNumber(Nothing) Mod 2,  &quot;White&quot;,&quot;#fff4cb&quot;)&lt;br /&gt;=iif(RowNumber(Nothing) Mod 2,  &quot;White&quot;,&quot;aliceblue&quot;)&lt;br /&gt;&lt;br /&gt;You can use custom clours as well.&lt;br /&gt;&lt;br /&gt;To use the custom colours create a custom colour in the expression window then double click the colour and the code will appear in the text box.&lt;br /&gt;&lt;br /&gt;For alternate colours in a matrix row group use :&lt;br /&gt;&lt;br /&gt;=IIf( RunningValue (Fields!FIELDNAME.Value, CountDistinct, Nothing) MOD 2, &quot;Transparent&quot;, &quot;aliceblue&quot;)</content><link rel='replies' type='application/atom+xml' href='http://reportingservicestnt.blogspot.com/feeds/4119022710938900060/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://reportingservicestnt.blogspot.com/2010/01/tips.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/4119022710938900060'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/4119022710938900060'/><link rel='alternate' type='text/html' href='http://reportingservicestnt.blogspot.com/2010/01/tips.html' title='Alternating colours'/><author><name>abs</name><uri>http://www.blogger.com/profile/08183235261376957091</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3581668942031605287.post-4705308901330277729</id><published>2010-01-25T15:24:00.000+00:00</published><updated>2010-05-12T12:33:49.257+01:00</updated><title type='text'>Reporting Services Tips n Tricks</title><content type='html'>Hi, I have started this blog so I could keep all my reporting services tips in one place.</content><link rel='replies' type='application/atom+xml' href='http://reportingservicestnt.blogspot.com/feeds/4705308901330277729/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://reportingservicestnt.blogspot.com/2010/01/reporting-services-tips-n-tricks.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/4705308901330277729'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3581668942031605287/posts/default/4705308901330277729'/><link rel='alternate' type='text/html' href='http://reportingservicestnt.blogspot.com/2010/01/reporting-services-tips-n-tricks.html' title='Reporting Services Tips n Tricks'/><author><name>abs</name><uri>http://www.blogger.com/profile/08183235261376957091</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>