CREATE FUNCTION [dbo].[get_date_only] (@date datetime) RETURNS datetime AS BEGIN RETURN dateadd(day, DateDiff(day, 0, GetDate()), 0) END
CREATE FUNCTION [dbo].[get_month_end] (@date datetime) RETURNS datetime AS BEGIN RETURN dateadd(ms, -3, dateadd (m,datediff(m,0, dateadd(m,1,@date)),0)) END
CREATE FUNCTION [dbo].[get_month_start] (@date datetime) RETURNS datetime AS BEGIN RETURN dateadd(m,datediff(m,0, @date),0) END
CREATE FUNCTION [dbo].[get_today_end] (@today datetime) RETURNS datetime AS BEGIN return dateadd(ms, -3, datediff(d,0,dateadd(d,1,@today))) END
CREATE FUNCTION [dbo].[get_today_noon](@date datetime) RETURNS datetime BEGIN RETURN DATEADD(hh, 12, DATEADD(d,DATEDIFF(d,0, @date),0)) END
CREATE FUNCTION [dbo].[get_today_start] (@today datetime) RETURNS datetime AS BEGIN return dateadd(day, 0, datediff(d,0,@today)) END
CREATE FUNCTION [dbo].[get_tomorrow_noon](@date datetime) RETURNS datetime BEGIN RETURN DATEADD(hh, 12, DATEADD(d,DATEDIFF(d,-1, @date),0)) END
CREATE FUNCTION [dbo].[get_week_end] (@date datetime) RETURNS datetime AS BEGIN return dateadd(yyyy, datepart(yyyy, dateadd(weekday,7-datepart(weekday, @date),@date))-1900, 0) + dateadd(ms, -3, dateadd(dy, datepart(dy, dateadd(weekday,7-datepart(weekday, @date),@date)),0) ) END
CREATE FUNCTION [dbo].[get_week_start] (@date datetime) RETURNS datetime AS BEGIN return dateadd(yyyy, datepart(yyyy, dateadd(weekday,1-datepart(weekday, @date),@date))-1900, 0) + dateadd(dy, datepart(dy, dateadd(weekday,1-datepart(weekday, @date),@date))-1,0) END
CREATE FUNCTION [dbo].[get_weekday_end] (@weekday tinyint, @date datetime) RETURNS datetime AS BEGIN return dateadd(yyyy, datepart(yyyy, dateadd(weekday,@weekday- datepart(weekday, @date),@date))-1900, 0) + dateadd(ms, -3, dateadd(dy, datepart(dy, dateadd(weekday,@weekday-datepart(weekday, @date), @date)),0) ) END
CREATE FUNCTION [dbo].[get_weekday_start] (@weekday tinyint, @date datetime) RETURNS datetime AS BEGIN return dateadd(yyyy, datepart(yyyy, dateadd(weekday,@weekday- datepart(weekday, @date),@date))-1900, 0) + dateadd(dy, datepart(dy, dateadd(weekday,@weekday-datepart(weekday, @date), @date))-1,0) END
CREATE FUNCTION [dbo].[get_year_start] (@date datetime) RETURNS datetime AS BEGIN RETURN DATEADD(year,DATEDIFF(year,0, @date),0) END
CREATE FUNCTION [dbo].[get_yesterday_end] (@today datetime) RETURNS datetime AS BEGIN return dateadd(ms, -3, datediff(d,0,@today)) END
CREATE FUNCTION [dbo].[get_yesterday_start] (@today datetime) RETURNS datetime AS BEGIN RETURN dateadd(day, -1, datediff(d,0,@today)) END
Then create a Table-Valued Function like so:
CREATE FUNCTION [dbo].[udfCommonDates] (@date datetime) RETURNS @t table (week_start datetime, week_end datetime, lastweek_start datetime, lastweek_end datetime, month_start datetime, month_end datetime, lastmonth_start datetime, lastmonth_end datetime, yesterday_start datetime, yesterday_end datetime, today_start datetime, today_end datetime, thisweek_monday_start datetime, thisweek_monday_end datetime, year_start datetime, year_end datetime, tomorrow_noon datetime, today_noon datetime, date_only datetime) BEGIN INSERT @t SELECT dbo.get_week_start ( @date ) AS week_start, dbo.get_week_end ( @date ) AS week_end, dbo.get_week_start ( DATEADD(d, -7, @date ) ) AS lastweek_start, dbo.get_week_end ( DATEADD(d, -7, @date ) ) AS lastweek_end, dbo.get_month_start( @date ) AS month_start, dbo.get_month_end ( @date ) AS month_end, dbo.get_month_start ( DATEADD(m,-1, @date) ) AS lastmonth_start, dbo.get_month_end ( DATEADD(m,-1,@date) ) AS lastmonth_end, dbo.get_yesterday_start ( @date ) AS yesterday_start, dbo.get_yesterday_end ( @date ) AS yesterday_end, dbo.get_today_start (@date) AS today_start, dbo.get_today_end ( @date ) AS today_end, dbo.get_weekday_start(1,@date) AS thisweek_monday_start, dbo.get_weekday_end(1,@date) AS thisweek_monday_end, dbo.get_year_start(@date) AS year_start, dbo.get_year_end(@date) AS year_end, dbo.get_tomorrow_noon(@date) AS TomorrowNoon, dbo.get_today_noon(@date) AS TodayNoon, dbo.get_date_only(@date) AS DateOnly RETURN END
Now the RS folks might be thinking but how does this help me as I need a dataset and a dataset can only be based on a Stored Procedure or a direct table. No problem create the following stored procedure:
CREATE PROCEDURE [dbo].[uspCommonDates] AS begin set datefirst 1 declare @date datetime set @date = getdate() select * from dbo.udfCommonDates(@date) end
Now you've got a stored procedure to use as a dataset...Now in reporting services add a new dataset:
Now go to the report parameters section of the report:
Now pick that dataset dsFunctions (or whatever you called it) and then pick any of the value fields from the scalar functions such as:
I've a requirement per below business rule to change the Scheduled Delivery Date on the report. Below is the DDL:
1) If the Job has a batch number, the Scheduled Ship Date will be next monday to Requested Delivery Date. Say for example if the job has Requested Delivery Date as 2015-07-29 and it also has a batch number then Scheduled Ship Date will be 2015-08-03.
2) If the Job does not have a batch number then the Scheduled Ship Date will be the Monday before the REquested Delivery Date. Say for example if the Job J012347 has Requested Delivery date as 2015-08-04 and it does not have batch number then the Scheduled Ship Date will be the Monday before i.e. 2015-08-04.
Similarly if the Requested Delivery date is 2015-08-07 and it does not have a batch number then Scheduled Delivery Date will be 2015-08-03.
DECLARE @Date datetime; SET @Date = GETDATE(); DECLARE @TEST_DATA TABLE ( DT_ID INT IDENTITY(1,1) NOT NULL PRIMARY KEY CLUSTERED ,JobNumberVARCHAR(10) NOT NULL ,JobStatus CHAR(1) NOT NULL
On my SSRS report, I use a date parameter to let the user select a date with the little calendar tool. When a date is selected, I have a small bit of coding run to convert the date to text, because when the report first fires up, the field is populated with "1/1/1900," and I need that turned into a blank character to let the report pull up all rows. So far, all well and good.If someone picks a date, then the report will filter the data on that selected date. Works fine.
But, it appears there is no way to get the calendar tool to go back to allowing ALL dates - so that all records are pulled - except by manually typing in, or selecting it with the tool, 1/1/1900.If I try to clear the field, causing it to use '' as a WHERE criteria (WHERE AdmitDate LIKE '%' + @AdmitDateTxt + '%'), it repopulates the field with the last selected date. So, I guess the question is, how does one tell the calendar tool for picking dates for a date parameter to reset back such that all records are pulled, not just those for a single date, without being required to type in, 1/1/1900? Or, is there some way of telling the date parameter to select all dates?
I have a report that uses several filters including a from and to date filter, I have a field named TimeLastMod which is a Timestamp. I am extracting the From and To dates from this field using Select format(TimeLastMod,'MMM') as FromMonth,format(TimeLastMod,'MMM') as ToMonth From Eventlogs syntax.
These I pass on to a parameter and eventually to a tablix filter in an between opeartion. When I run the report, the records returned by the report is not what is expected as it sometimes returns an extra months data e.g., using between Aug and Sept will return october data as well.
I have a table in which records are inserted daily and with them i am storing the dates also. Now in SSRS i need to show the data for one week . The format should be like :
In above example Business Name , Phase, Activity will repeat lonely but its work description will be generated in next section according to that business name and that date. How to achieve this task ? I have referred : [URL] ....
I have a requirement to display project start date and finish date in timescale view. The data in database table available as per below -The start date and project finish date should fill color in the timeline view as per below example, by quarters for a current financial year, last year and plus two years a head.
Code : protected void Page_Load(object sender, EventArgs e) { Session["ID"] = "2"; string strConnString = ConfigurationManager.ConnectionStrings["BSDConnectionString"].ConnectionString; var con = new SqlConnection(strConnString); using (var sda = new SqlDataAdapter())
[Code] ....
That was my code , now lets see what my problem is :
I am getting only two dates in a single row from sql to my asp.net webform and then bindng those dates in jQuery UI Datepicker. Now if i set session to 1 then date picker works well but if i put session = 2 , it shows the end date till 2020 which is wrong.
Below are the dates which are fetched from database and i have copied here for your ease.
When Session["ID"] = "1"; Start Date : 01/07/2014 00:00:00 End Date : 05/02/2015 00:00:00
When Session["ID"] = "2";
Start Date : 07/04/2015 00:00:00 End Date : 27/08/2016 00:00:00
I have set my mindate to startdate and maxdate to end date. please check and see where the error is happening.
Also point of interest is that if i don't fetch values from database and use only List<string> in my web method then every thing works well. like this :
[WebMethod] public static List<string> GetDates() { List<string> arr = new List<string>(); arr.Add("2014-07-01"); arr.Add("2015-02-05"); return arr; }
I have created range bar chart and I am not able to achieve the following tasks.
1. Change X-axis Label Format to Quarter:
I have x-axis with dates and y axis of project groups. I have changed x-axis interval type = month and interval=3.
Set the Maximum = Max(ProjectEndDate) and Minimum = Min(ProjectStartDate).
Now my chart showing 3 months x-axis interval dates in mm/dd/yyyy format. I want to change this interval date format to Quarter. The problem is LabelsFormat property is not recognize the "=Q or q or quarter" and also not accepting the expressions. How can I achieve this?
2. Placing series side by side when it is not overlapping
I want to place the same group series side by side only when the previous project end date is less than next project start date, otherwise place the next project to next row. How can I achieve this?
I am trying to migrate my reports from SQL server 2000 reporting services 32bit to 2005 64bit. I am following the migration steps that MS specified. Restored my Reportserver and ReportserverTempDB databases Then I was using the configure Report services to upgrade these databases but I always end up getting the follwoing exception when I run the upgrade on the "Database Setup" configuration for 'ReportServerTempDB' database System.Data.SqlClient.SqlException: Could not locate entry in sysdatabases for database 'ReportServerTempDBTempDB'. No entry found with that name. Make sure that the name is entered correctly. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at Microsoft.ReportingServices.Common.DBUtils.ApplyScript(String connectionString, String script) at ReportServicesConfigUI.SqlClientTools.SqlTools.ApplyScript(String connectionString, String script)
It's driving me crazy, why is it looking for 'ReportServerTempDBTempDB' in the catalog instead of 'ReportServerTempDB'? Is it possible to migrate from 32bit to 64bit?
I'm attempting to obtain a cost effective solution for my existing customers to develop reports on their SQL 2000 Server installations using their Reporting Services 2000. With products like Visual Basic.NET 2003 becoming almost impossible to obtain, I have at least one customer who is running into a dead end.
One option possibly is the SQL Express with Advanced Services download, which has Reporting Services. My questions are as follows:
Can the report designer component of SQL Express Reporting Services be configured to connect to an external database (which would happen to be a SQL 2000 database) to establish its datasets? Does the resultant designed report end up in an RDL file? If the customer published this report via the Reporting Services 2000 Report Manager, would the report be able to run?
Sorry for asking a question like this that I could probably answer on my own, but my customer needed this answer yesterday. I have scoured the web and microsoft sites - and posted a question on the official SQL Reporting Services cateogy ... in an attempt to answer the basic question of how to design reports for Reporting Services 2000 in the absence of Visual Basic.NET 2003 (or other .NET 2003 tools) with no success.
Does anyone know the system tables I need to query to produce a report of stored procedures (SQL 2005) that had any changes made to them in a user-specified date range?
In SQL 2005, I saw the canned database reports, but this one didn't exist. Any help would be greatly appreciated.
I work in a big project and we will begin in using reporting services as the base technique for reports and I will be responsible for this part. but I have a problem I will discuss in the following:
Currently: We use currently devexpress reports and we have 2 languages(Arabic and English). the data in tables saved in two ways (Arabic and English). when the end user change the language of the web site the report data language changed when run it.
Example:
we have table with (ID, NAME_AR, NAME_EN, JobTitle_AR, JobTitle_EN). designed report will display(ID, NAME_EN, JobTitle_EN) . but the end user change the language of the system the report will
Our DBA has installed reporting services on a server and now in order to access the report manager, one has to be an Admin on that Server. I am guessing that there is a mistake in the configuration of Reporting Services. Usually it should allow anybody who was added to the roles in the properties section of the Report Manager, right? I have also added the users to the DB..
Also I am using Windows Authentication to access Report Catalog items (Reporting Services is installed on Server2) from a web Application(deployed on Server1) and displaying the report using report viewer. For some reason, server1 has to be in an Admin role on Server2 to access the report catalog/report. This is kinda strange for me as I don't want everybody to be an Admin on Server2. Can anybody please point in the right direction?
We have installed SQL Server 2005 with reporting services.When tried to open getting errors as below: how to avoid such errors See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.
ReportServicesConfigUI.WMIProvider.WMIProviderException: A WMI error has occurred and no additional error information is available. ---> System.Runtime.InteropServices.COMException (0x8000000A) at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
I have some problem about reporting service add-in.
After I install reporting service add-in for SharePoint, reporting service menu does not appear in Application Management Tab in SharePoint Central Administration.
I try to uninstall and re-install again, it remain not work.
I have a SSIS package which is reading from an Excel file.
The Excel is created from a report from another system and sometimes the date of birth formats as a Date and sometimes as string.
I've added a data viewer so I can see how the columns are read as soon as SSIS reads the file.
When the cell in Excel is set as text its read correctly - I can then convert to a date as necessary
When the cell in Excel is set as date its read in US format! i.e. if it was 01/13/2014 in excel its read as 13/01/2014
How can I get round this? Its not an option to manually force the column to be text once exported from the system as my package picks this up automatically.
I have tried
-Regedit set typeguessrows = 0 -IMEX = 1 in connection string -Set LocaleID = UK in the data flow task to read from Excel
We've got a requirement to build the real time report. user can browse report at any point of time and need to see the latest data(stock market) in the report.
I've few options down...
1. Directly point to OLTP database as source and write stored procedure to show result set.
2. Replicate the database and write the SP's to reports. To avoid pointing directly to OLTP db.
3. To build the datawarehouse with dim & facts to show it in reports. I prefer this as a standard method, but this would have some latency depending on trasaction load which will differ from the requirement.
We are required to gather certain information regarding reporting services.
Which reports were requested, by whom , how long did they run for, what parameters were passed etc etc.
I see that the system tables do provide some of this information, is there a 3rd party tool or something we can use to gather all this type of information for us?
Hi, I have just install SQL 2005 SP2 and trying to get Window SharePoint Services V3 integrated with SQL 2005 SP2 reporting services. In SharePoint Central Administration, I select the Reporting Services Integration page and have setup the Report Server Web Service URL and Authentication Mode. I then goto Grant database access, specify the SQL server name, get promted for a username and password that has access SQL Reportserver and get the following error "The group name could not be found" Does anyone have any ideas? Thanks
We built our prod server [vm] with SQL Server 2008 R2 on Server 2008 R2. It works nicely. Then we made a copy of the VM and renamed it (so our test environment would be IDENTICAL to production). After that, SSRS was broken: I get "HTTP Error 503. The service is unavailable." I can't connect via http, or SSMS.
We have tried:
* Running SSRS config tool (several times)
* Running with/without the IIS Server Role
* Dropping & recreating the SSRS keys
* Recreating the ReportServer database, etc
* Checking all of the accounts, permissions, etc
* Running SQL Repair
* Going through the registry to fix any references to the machine's old name
* Uninstalling, reinstalling SSRS
* Completely uninstalling ALL of the parts of SQL Server 2008 R2, deleting all directories, removing references to SQL Server from the registry, rebooting, reinstalling everything.
None of this has worked. SSRS [R2] is still 503 on our test box.
the SSRS [NT] service seems to run, without error. The Event Viewer doesn't seem to be recording any errors. The SSRS logs say that the default URL is wrong, but we get the same error in Prod, and Prod works fine. The other SQL Logs say something about not being able to contact the service. However, as I said, the [NT] service seems to be working fine.
I think I've seen a similar post on a blog or on the forums - but it seems like this should be possible -
I have an MDX query - that works fine in SQL Enterprise Manager, and has my dimension members on columns, and my measures on the rows. When I try the same query in Reporting Services, I get the error:
"The query cannot be prepared: The query must have at least one axis. The first axis of the query should not have multiple hierarchies, nor should it reference any dimension other than the Measures dimension.. Parameter name: mdx (MDXQueryGenerator)"
Although it works when you pivot the view, I really need my data presented with the members on the columns and the measures on the rows. Another forum post mentioned using the SQL 9.0 driver, but I can't see this listed anywhere (the only one I see is the .NET framework Data Provider for Microsoft Analysis Services).
Here's what my query looks like -
SELECT { [Time].[Month].&[2006-09-01T00:00:00] , [Time].[Month].&[2006-10-01T00:00:00], [Time].[Month].&[2006-11-01T00:00:00], [Time].[Month].&[2006-12-01T00:00:00] } on COLUMNS, { [Measures].[Unique Users], [Measures].[UU Pct 1], [Measures].[UU Pct 2], } ON ROWS FROM [Cube]
I'm trying to create reports in RS2005 using AS2000 as my data source. I understand that if I use RS2005 on AS2000, I wont be able to enjoy the OLAP based parameters as in using AS2005. Does anyone know an easy way to easily use Parameters in RS2005 while still using AS2000?
I'm using Reporting Services 2005 SP1 and wrote some code to render reports server-side. My sample report has few parameters that must be passed so I pass these parameters with code.
byte[] report = rs.Render("PDF", "<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>", out extension, out mimeType, out encoding, out warnings, out streamID); </My code>
Actually, I have several more parameters but I've checked the collection and all the parameters I want are there and have values. Their names match those found in executionInfo.Parameters. But when I run my code I get the following error on Render():
<Error> "This report requires a default or user-defined value for the report parameter 'pClass'. To run or subscribe to this report, you must provide a parameter value. ---> This report requires a default or user-defined value for the report parameter 'pClass'. To run or subscribe to this report, you must provide a parameter value. ---> This report requires a default or user-defined value for the report parameter 'pClass'. To run or subscribe to this report, you must provide a parameter value." </Error>
I've double-checked and my parameter array does have the problematic parameter, I passed it a value but when I check executionInfo.Parameters I see that it's the only parameter that hasn't been give a default value after calling SetExecutionParameters(). So my parameters do seem to be passed but one seems to refuse getting a value. If I comment out the SetExecutionParameters() line I get, as expected a similar error but on another parameter (first one in the executionInfo.Parameters collection). So I'm left to beleive that the SetExecutionParameters() has some kind of bug as it works for all but one parameter. I've checked casing, spelling, tried passing phony parameters and from what I've seen I should be getting an error when I pass the parameters if I got something wrong.
I am invoking RS web services to render reports, using Apache Axis to generate stub classes from Reporting Service WSDL.
Please let me know if I can integrate Report Viewer control in the jsp where I am writing the report output. Else do I have to create my own custom tags simulating ReportViewer functionality.
My requirement for the parameter is multivalue parameter with a text box. for example when user enters aa15 it need to include product aa15. when the user enters aa15, aa16, zz15 than it needs to include all the three products. the last case is when the user enters AA** than i need to inclued all the products start with AA. when i use default multivalue parameter with data source analytical services than i am getting a drop down box. I dont want that. I need a text box where user can enter the value. 1. In sql we have a like key word to query . for example select * from product where product like "AA%". what is equavalent mdx query to get such results ? 2.How to impliment the multivalue parameters without using dropdown box?
I am facing sever Refresh issue in PPS Reports. I have Two Dashboard
Dashboard_One and Dashboard_Two
I have few Filters on both the Dashboard .
In Dashboard_One I have 2 Filters
1)Year filter where Year 2012 is my Default value 2)City Filter where "CityOne" is Default Filter Value
If I select Year"2010" in Period Filter and "CityTwo" In City Filter.I see Related reports . Now I navigate to Dashboard_Two to See Other Reports where I have few Other Filter Like "Country" where I select "CountryThree" . When I navigate Back to Dashboard_one I do not see Dashboard with Default value given to them
I still see Filter value Year=2010 and CountryFilter="CountryTwo" in Dashboard Dashboard_One .. where as I should have seen it based on the Default value given to the Filter.. How should I resolve this refresh issue which I am facing in PPS Dashboard. I do not see Default value in the Filter ,It always give the filter value which was selected later when Navigated back.