I adopted a site that stores items in a database that have a date associated with when those items were developed. However, it wasn't stored as an actual date, but rather a jumble of characters from which you can infer atleast the quarter. Thing is, there is no standard length, but I know I always want the last 5 characters. The format looks something like this:
ab_q1_03
The "ab" could be various lengths of whatever characters. "q1_03" means the first quarter of 2003, and this information will always be the last 5 characters of this column. I'd like to get a count of items for each quarter, but I'm not exactly sure how to group that. Any ideas?
im using reporting services to genarate a report and its calling S.Procedure to get the results. When i ran this report from the report server, it took about 10 mins to generate it. but when i ran the same SP in query analyzer it took only 1 second. Reporting server is on different box and database on different ( separate boxes) when i check the performance monitor (in Database box) its gone high when the report is running(for about 10 mins)
How can i optimized the same query for reporting ?
I have created a report that lists a work request ID, work type, short description and the engineer that is assigned to the request. All the information about the requests are in the Request table. I want the user to be able to click on the work request ID (1002) and see the entire record. I cannot come up with an SQL query that will display the specific work request. I know select * from Request will show everything in the table but how do I pull only the information for ID 1002? Thanks.
Although not totally related to this RS cat but since I'm using the query in Reporting Services perhaps I can get a work around from someone. I've created a Rolling 2 year 12 month comparison report that compare sales figures from current and previous years. The query works fine however the query fails to return 0's for no sales for a particular month with no records. Is there anyway I can return a 0 instead. As you can see I tried "isNull to no avail.
Query==========>
SELECT Customer.Country, MetaDates.Month, MetaDates.Year, isnull(SUM(Order_Line_Invoice.Sales),0) AS Sales, SUM(Order_Line_Invoice.Cost) AS Cost, SUM(Order_Line_Invoice.Sales) - SUM(Order_Line_Invoice.Cost) AS GM, 'Current 12 Months' AS yearNum
FROM Order_Line_Invoice INNER JOIN Customer ON Order_Line_Invoice.CustId = Customer.CustId INNER JOIN MetaDates ON Order_Line_Invoice.InvoiceDate = MetaDates.Date LEFT OUTER JOIN Product ON Order_Line_Invoice.ProdId = Product.ProdId WHERE (Customer.country = @GroupByFieldFilter) and (Order_Line_Invoice.InvoiceDate BETWEEN dateadd(m, datediff(m, 0, DATEADD(month,-11,@EndDate) ), 0) AND @EndDate)
GROUP BY MetaDates.Year, MetaDates.Month, Customer.country
UNION
SELECT Customer.Country , MetaDates.Month, MetaDates.Year, isnull(SUM(Order_Line_Invoice.Sales),0) AS Sales, SUM(Order_Line_Invoice.Cost) AS Cost, SUM(Order_Line_Invoice.Sales) - SUM(Order_Line_Invoice.Cost) AS GM, 'Previous 12 Months' AS yearNum
FROM Order_Line_Invoice INNER JOIN Customer ON Order_Line_Invoice.CustId = Customer.CustId INNER JOIN MetaDates ON Order_Line_Invoice.InvoiceDate = MetaDates.Date LEFT OUTER JOIN Product ON Order_Line_Invoice.ProdId = Product.ProdId WHERE (Customer.country = @GroupByFieldFilter) and (Order_Line_Invoice.InvoiceDate BETWEEN dateadd(m, datediff(m, 0, DATEADD(month,-23,@EndDate) ), 0) AND dateadd(m, datediff(m, 0, DATEADD(month,-11,@EndDate) ), -1))
GROUP BY MetaDates.Year, MetaDates.Month, Customer.country order by MetaDates.Year, MetaDates.Month asc
Location Tree View --- .___ Building A . .___ Room 1 . .___ Room 2 . .___ Partition 1 . .___ Building B . .___ Room 1
on tblAssetPlacement, the column PlacementDate is a unix timestamp stored as bigint. the higher of its value means it is the latest placement.
so i had created a sql to pull the data like this:
SELECT tblasset.AssetName, tblassetplacement.OfficerInChargeID, tblassetplacement.Locationid, tbllocation.LocationName FROM tblasset,tblassetplacement, tbllocation, (select tblassetplacement.AssetID,tblassetplacement.LocationID,MAX(tblassetplacement.PlacementDate) AS LatestDate from tblassetplacement group by tblassetplacement.AssetID) temptbl where tblasset.AssetID = tblassetplacement.AssetID and tblassetplacement.PlacementDate = temptbl.LatestDate and tblassetplacement.AssetID = temptbl.AssetID and tbllocation.LocationID=tblassetplacement.LocationID ;
this will output: --- AssetNameOfficerInChargeIDLocationIDLocationName IPODSusan6Room 1 Sony PS3Fred5Partition 1
i would need to have a column ParentLocationName that directly shows the name of the parent's location as below: --- AssetNameOfficerInChargeIDLocationIDLocationNameParentLocationName IPODSusan6Room 1Building B Sony PS3Fred5Partition 1Building A
is there a way to pull the parent's location name in one sql syntax?
I have a process that stores a machine status every 2 minutes in a bit field of an SQL database. Running = True, Stopped = False. I am trying to build a report that shows the percent run time every hour. This information would be the count of Trues divided by the total count for each hour. I can select and group the data on the hour but I can either count() the total number of readings or count() the number of readings where the status is true. How do I collect both pieces of information in the same data collection?
SELECT TOP (100) Max(Time) As Time_M, Count(Running) As Count_T FROM Compact10 Group by DatePart(mm,Time), DatePart(dd,Time), DatePart(hh,time) Order by DatePart(mm,Time) desc, DatePart(dd,Time) desc, DatePart(hh,time) desc
Hi, Using Reporting Service 2005, I want to give User an Interface where user can directly paste sql query like - select * from employee. and corrosponding data will be displayed to user. Is there are any way? Thanks, Ashwin
Just a general question about any recommendations for a third party tool that would allow setting up a data-dictionary against SQL Server tables and a user could go in and build their own queries, reports. Perhaps they could save their query/report definitions for reuse. Other nice to haves - ability to output to PDF and export to XLS. Would prefer web interface, but can consider desktop as well. Any immediate recommendations?
I need to change the default member of my Time dimension according to a parameter received by a report in Reporting Services. When I code the MDX query I can't seem to be able to begin my statement with an ALTER CUBE to set the default dimension. It seems I can only do a SELECT..FROM..WHERE query.
Does anyone know how to set the default member of a dimension in a report ??
We are trying to implement a 2 tier architecture for our inbuild SQL 2005 backed online application. We want the SQL Reporting Server Interface --- Reporting service website to sit on Server 'A' and the actual reporting server to sit on Server 'B'.
Can someone suggest or advise us how to proceed with this.
Server 'A' is our application server and has IIS & Application. Server 'B' is our DB server and has IIS,SQL 2005, Reporting Server,Intergration Service.
The Gobal value for the reporting timeout is 10 minutes (600).
I Have a report which takes around (1hr to run).. The report correctly timesout (page cannot be display) but the query kept on running..until it completed.
Is there any way to stop this from happening (Report and Query timeout after 10 minutes)
I have look on the internet and in my rsreportserver.config .. <Add Key="SQLCommandTimeoutSeconds" Value="60"/> <Add Key="MaxActiveReqForOneUser" Value="20"/> <Add Key="DatabaseQueryTimeout" Value="120"/>
Hello, This is chirag patel. we are going to SSRS with our asp.net application to generate reports and charts. i having query about license of SSRC.
Is it completely free with SQL Server ? i mean if my web application will have SQL server 2005 as Database on production server , then do we need to purchase anything else to use SSRC ??
can anyone please let me know brief detail about license of SSRC if we want to use SSRC with web based application ??
I have SQL 2008 R2 instance and would like to install SSRS 2012. I have below query related to database configuration...Is there any performance impact while using SQL 2008R2 instance?Once configured SSRS database on 2008 R2, Will there any issue if we move our SQL instance from 2008R2 to SQL 2012 in future?
I have the following store procedure which execute perfectly fine Under SSMS as it is :
-- Insert statements for procedure here SELECT APHIST.ReturnDate AS ATDATE ,API_HIST.[ActionPlanItemID] ,API_HIST.[ActionPlanID] ,PIT.[ProductItemID] ,PIT.ProductItemCode
[Code] ....
But then when I try to create a dataset using ReportBuilder and pointing to that StoreProcedure, I get the following error message box :
"Could not update a list of fields for the query. Verify that you can connect to the data source and that your query syntax is correct. An item with same key already been added" ...
When I use an SSAS cube in Excel the command text is just the name of the cube itself and does not require an MDX query. Is it possible in SSRS to avoid writing an MDX query?
I recently changed my datasource in our Reporting Service Model. We changed to a quicker SQL server with disk capacity. I am able to run new reports but when I try to run old ones that were on the old datasource, I get an error. The datasource has been changed to point to the new server (datasource).
The error is: An error has occurred during report processing. (rsProcessingAborted) Semantic query compilation failed: e EmptySemanticQuery The SemanticQuery does not contain any Groupings or MeasureGroups. SemanticQuery must contain at least one of these elements. (SemanticQuery ''). (rsSemanticQueryEngineError)
I have one view, i written below query to get employee hierarchy based on orgid and employee name..
If i select employeename it shoukd show employee reporties(under employees and below employee reporties like tree structure)
It is running fast in SSMS Level, but it is taking more time in SSRS(Sql Sever Report Services), If i run this query in SSRS,Some times System not responding.
Declare @OrgId int Declare @EName varchar(30) Set @OrgId=56793 Set @EName='ABCD' Select EmpId
SELECT dbo.incident.incident_ref, Customer.cust_n,incident.date_logged FROM incident INNER JOIN Customer ON incident.incident_id = Customer.cust_id WHERE incident.date_logged BETWEEN @date_from AND DATEADD(day, 1, @date_to)
I need to use a condition here to display customer based on my selection in dropdown list (Include ABC )
I'm using Report builder 3.0 to create a report. In the design, datatset query i have a sql to calculate difference between two dates (date1-date2) as processing time. I have this (processing time ) ONLY in my ORDER by clause and when i execute the statement it does exactly what i was looking for , however when i run the report the sort order is not delivered. I checked each column tablix properties and the sorting order is set for Processing Time.
I have a query where I am trying to display the most recent information about travelling method of customers using "t.collection_date". I am struggling to get MAX function working in the query.
SELECT P.id, P.forename, P.surname, P.dob, c.postcode, l.code_des, MAX(t.collection_date) FROM People p, MOT_HIST t, lk_mode_of_travel l, corresp_address c
WHERE p.ID = t.id (+) AND t.mode_of_travel = l.int_code (+) AND p.id = c.entity_id (+)
In my SELECT query I have: MIN(a.orderdue) AS 'Oldest order date'
This works in that it brings through the oldest order date, however it brings through a date format like: 2015-06-11 11:30.000
So I amended the SELECT query to:
MIN (CONVERT(varchar(17),a.orderdue,103)) AS 'Oldest order date'
This brings the date through as 11/06/2015, which is preferable.
But I have noticed that doing this has affected the output: the MIN function no longer returns the first (oldest) date, but a completely different value.
Obviously my changing the formatting for the date has affected the MIN output. Is there any way I can amend the formatting of the date without this happening?
Hello--I do not know if this group can help me with SQL Server Reporting Services ... but here it goes. I have a report built on a query and I want to be able to send a parameter (@theWhere) that is a string which is a where clause "(MEGLOMART_TYP_CODE <> 'XYZ' AND MEGLOMART_STAFF_SHORTAGE > 25)" these strings can vary depending on what columns the user selects and what operators they want to use. Generation of proper SQL for the where clause has been verified, I just need to be able to pass these, is there any way to do this...see example query below and how I was planning on using the @theWhere variable...
I was wondering on a question that : exporting a report to xlsx is feature of SSRS server or of Report viewer control itself.I have multiple report servers (eg 2008 R2, 2012 and 2014) . I am using a windows application and reportviewer version 9.0.So when I use report server 2008 R2 its not showing the xlsx export option but working fine with other report servers.Again I changed the control to 11.0 (also 12.0) and checked the same scenario and same results with Reporting server 2008 R2 but working fine with 2012 and 2014. if its worth to change the Report Viewer control or just changing the server is okay to achieve the functionality of exporting to xlsx.
I can run the following query in Management Studio, but get the error listed below when I run it from the data tab in Reporting Services:
declare @starttime as datetime declare @endtime as datetime declare @timezone as integer declare @date as datetime
set @timezone = 1 set @date = '5/1/2007'
set @starttime = dateadd(hh, @timezone, @date) set @endtime = dateadd(d, 1, @starttime)
select @Starttime, @endtime from site
Error Message:
TITLE: Microsoft Report Designer ------------------------------
An error occurred while executing the query. The variable name '@starttime' has already been declared. Variable names must be unique within a query batch or stored procedure.
The variable name '@starttime' has already been declared. Variable names must be unique within a query batch or stored procedure. (Microsoft SQL Server, Error: 134)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=08.00.2039&EvtSrc=MSSQLServer&EvtID=134&LinkId=20476
------------------------------ BUTTONS:
OK ------------------------------
What I am trying to accomplish is the ability for users to select which time zone they want the data in the report to display in. To do this, I created a timezone parameter that has the offset from Central Time (which is how all data is stored in our database).
I have a report that prompts the user to select a parameter, for simplicity, let's say the parameter is for color choice, options are Red, Yellow, Blue or *. The * is for include all colors. I am passing that parameter back to the dataset query which, again for simplicity is
select Hue from AvailableColors whereColor = @ColorParam.
For a specific color this works fine, for the "*" selection it returns a null. It would seem that I need to convert the * to % but I am not sure how.....
Is it possible to use a parameter in a ldap query using the ADsDSOObject provider? I keep getting an error "The ICommandWithParameters interface is not supported by the "ADSDSOObject" provider". Command parameters are unsupported with the current provider.
I don't have a linked server on my DB server to Active Directory so I'm just querying in the SSRS report design. Here is my query for my dataset. If I hard code an example it works. Just doesn't work when I pass a parameter. I've tried making it an expression (= sign), Tried several syntax's, Tried everything I can think of. Is this possible? or do I just need to push for a linked server?
I am a beginner with Report Designer (and with Reporting Services). Following the tutorials 'Adding parameters to filter Reports ...' I tried using the @symbol to add a parameter to my query: where code = @code_value...I get the error: ORA -000936 missing expression (msorlib) Is there another syntax that I should use to define a parameter/variable in query for my oracle dataset?
I have to display the data in the below said formats..Current sample Data in the table and the data type is numeric(23,10)
50.00 0.50 0.00 0.00
To be displayed in the below format
1.25 0.75 0 0 1
I have to map this column in teh report and should dipslay like above.I think if 0.00 is available then it should display as 0..If 1.0 is available then it should display 1.Any value that has postive number after the decimal should display all the values example : 2.25,3.75,5.06, So in general the solution to display values like 1.75,1,0 we should not dispaly 0 as 0.00 and 1 as 1.00 and 2 as 2.00 and so on...Any Solutions in terms of SQL query or SSRS expression.
So I have a report that uses an MDX query to fetch the main data for the tablix. Then I have a custom row added which pulls data in via a Lookup function and references a different dataset. The report has 3 parameters. Each dataset uses those 3 parameters in its underlying query. However, the dataset referenced in the lookup function doesnt seem to be updating when change the parameters and re-run the report.