Tuesday, February 26, 2013

Subquery Inner Join with Date Manipulation

SELECT     SUM(COST_15 * RUNTTL_15) AS EXT
FROM         dbo.Transaction_History AS TH
INNER JOIN
(SELECT     PRTNUM_15 AS PART, STKID_15 AS STK, CAST(MAX(CAST(CONVERT(DATE, TNXDTE_15, 120) AS CHAR(10)) + ' ' + LEFT(TNXTIM_15, 2) + ':' + SUBSTRING(TNXTIM_15,
                       3, 2) + ':' + RIGHT(TNXTIM_15, 2)) AS DATETIME) AS DT
FROM         dbo.Transaction_History
WHERE     (TNXCDE_15 IN ('A', 'C', 'I', 'R', 'S', 'N', 'T', 'F')) AND TNXDTE_15 < '2012-12-01'
GROUP BY PRTNUM_15, STKID_15) AS TH1 ON TH.PRTNUM_15 = TH1.PART AND TH.STKID_15 = TH1.STK AND
CAST(CAST(CONVERT(DATE, TH.TNXDTE_15, 120) AS CHAR(10)) + ' ' + LEFT(TH.TNXTIM_15, 2) + ':' + SUBSTRING(TH.TNXTIM_15, 3, 2) + ':' + RIGHT(TH.TNXTIM_15, 2) AS DATETIME)
= TH1.DT

Tuesday, July 10, 2012

SQL Server 2008 Can’t see .bak files in Restore or Backup folders

To solve this you need to grant permissions in the folders to the service account you used to run the SQL Server services

 

Vincent Stefanetti

Monday, June 25, 2012

How to Pass Multi-Valued Parameters to another Report

Right click the cell you want to use to go to the other report

Select Text Box Properties

Select Action

Select Go to report

Specify a report and select the one you created that you want to go to.

Note:

The report you are going to needs to have the same settings as the parameters on the main report.

on the Go to report create the parameter with the same name as the main report

make it the parameter multi-valued

create a DISTINCT list data set for the multi-valued parameter to select from

i.e. SELECT DISTINCT COMCDE_01 FROM [TABLE OR VIEW NAME]

I also trimmed it to make it look better in the parameter drop down.

i.e. SELECT DISTINCT RTRIM(COMCDE_01) AS COMCCDE_02 FROM [TABLE OR VIEW NAME]

add the SQL IN statement in the Where cause i.e. WHERE COMCDE_01 IN (@COMCDE)

----

Click the Add buttom

the drop down will pickup the parameter from the Go to report

Click the Fx

Use =Split(Join(Parameters!COMCDE.Value, ","), ",") expression to create the multi-value parameter list that the Go to report will use.

Click OK

I had to set it up like this to make it work right for my DB

Hope this helps,

Vincent Stefanetti

Simple SQL Update with Join and Where Exists

UPDATE Part_Master
SET RECVEN_01 = VENID_10
from Part_Master as P INNER join Order_Master as O ON P.PRTNUM_01 = O.PRTNUM_10
WHERE EXISTS
(SELECT PRTNUM_10, VENID_10
FROM Part_Master as P join Order_Master as O ON P.PRTNUM_01 = O.PRTNUM_10
WHERE TYPE_01 = 'B' OR TYPE_01 = 'O'
GROUP BY PRTNUM_10, VENID_10)

Friday, November 19, 2010

Passing Parameters to a Drill Down that are not in the Report Item

Click Series Properties - Action - fx - under Category select Parameters and select the parameter value

Wednesday, August 18, 2010

SRS 2008 Gauges and Chart Guide

 

 

Adding Custom Color Palette to Your Reporting Services Charts - Concise

1) Click Chart Area
2) Click Custom Palette Colors
3) If you have prior added custom colors anywhere in the project you can then select them here or create them and add them to the custom palette.
4) Select Custom under "Palette" beneath the NoDataMessage property and you have your sutom set for the chart.