I have developed a cube in my work place for analyzing current year sales with previous year sales in Time Hierarchy (Year- Quarter- Month) using Parallel period. If we want to see data for particular Quarters i.e. Q1 and Q2 then total at the year level should also get change. Currently if we only choose 2 quarters in the filter then current year data gets change, however data using parallel period is not getting change accordingly and its shows Total of full year.
I have a QA Deployment Date field that is being returned in a custom report I created. I also found a sample date range parameter:
What I want to accomplish:
I want to select a From and To Date and filter the report to only display the rows that have the QA Deployment Date within the selected range.
For example.. I want to select From Date (8/1/2105) and To Date (8/31/2015) and I only want to return only the results that have a QA Deployment date between that selected range.
Example table: PeopleID Date Status 1 2004-01-01 True 1 2005-01-01 True 1 2006-01-01 True 2 2004-01-01 True 2 2005-01-01 False 2 2006-01-01 True
I'm trying to find a way to query whether or not someone has had a specific status for 3 years in a row. As you can see from the table above, PeopleID 1 has had a "Status" of "True" for 3 years in a row, whereas PeopleID 2 hasn't--there was one year where they had "False".
I'm wondering I can query this, or if I'm going to have to scan the records manually. :(
I suppose I could write a stored procedure and do some looping too.
I have a date filter, and I default it to first day this month and last day this month under relative date, when I run it it givis me error:
The Value expression for the report parameter FromDate contains an error: [BC30456] 'Date' is not a member of 'Integer'. (rsCompilerErrorInExpression)
I would like to create calculated measure which should give me closing holdings at all levels(week ,Month,Quarter and year levels.) whichever i pull in the browse pane.
Below calculated measure would show the holdings for whatever the level you have specified.
([Measures].[Holdings], ClosingPeriod( [DIM BI DATE].[Calendar].[WEEK], [DIM BI DATE].[Calendar].CurrentMember ))
But this measure shows the value for only week attribute.
for month,([Measures].[Holdings],ClosingPeriod( [DIM BI DATE].[Calendar].[Month], [DIM BI DATE].[Calendar].CurrentMember ))
But my aim is to create a calculated measure to give closing value for any level.
I'm trying to find if any part of a date range in my table between orig_start_rent and stop_rent falls within a period I specify in two variables: startPeriod and endPeriod
For example if I specify 2013-11-01 as startPeriod and 2013-11-30 as endPeriod, then if any part of the date range between orig_start_rent and stop_rent(stop-rent can be null if hire is open) falls within that period, I want that to be picked up and assigned the value of 1 in my case statement for OnHire. My code is not picking everything up however - using the example above, a record with orig_start_rent of 2013-05-23 and stop_rent of 2013-11-18 is being assigned 0 when it should be 1. My code here:
declare @startPeriod as smalldatetime declare @endPeriod as smalldatetime set @startPeriod = '2013-11-01' set @endPeriod = '2013-11-30'; select dticket, orig_start_rent, stop_rent, case when orig_start_rent >= @startPeriod and orig_start_rent <= @endPeriod then 1 when orig_start_rent < @endPeriod and stop_rent is null then 1 else 0 end [OnHire] from deltickitem
I have a report in Visual Studio that I want to limit to just the activity for today. Normally I would add a WHERE stmt to the sql script that says docdate=getdate(). However this does not return any data to me in VS. I have tried many different syntax. Does anyone have the correct syntax or filter value that works in Visual Studio? Thank you.
I am trying to make a chart by using data from a database.
What I am trying to do is this.
The user will have 3 options
Option 1.
View last quiz
Option 2.
View Data by week(up to 4 weeks).
Option 3.
View by month
Later once I get these down I will have view 7 days worth of data.
So I am not sure how to do option 2 and 3. I have not tired to do Option 1 yet so can't say yet.
Like say if I have a months worth of data and they choose Option 2 it should make 4 columns on my graph. However I don't know how to make my sql to filter like that.
A user also can do 0 or more quiz's a day so first all the values(total right, total wrong, total assitance needed) would need to be added up. After that the filter would have to be taken place so that it filters.
I have been trying to write a simple database program using VB and SQL Express. In doing so, I have run into a problem. I am trying to filter by a Date value. I have the following SQL in the background.
SELECT TransID, BIN, CarrierName, CheckDate, NumberOfClaims, BeginningDate, EndingDate, CheckAmount, Code, CheckNumber FROM Payments WHERE (CheckDate=@CheckDate) ORDER BY CheckDate DESC
I am using a datetimepicker to select a date value and pass it in. Doesn't work. I get an error about "errors converting string to date" or something like that. I thought datetimepickers passed date values.
Anyway, just executing the SQL query and typing in the parameter value gives the same results.
I have two tables, both have date/timestamp of some event. The first table has records of the correct date/timestamp and the second table has records with same date but different timestamps of the same event.
I need to write a SQL code that selects records where the date/timstamp in the second table is closest to the correct date/timestamp in the first table.
For example, first table has it like this
1/20/2005 8:00
The second table has
1/20/2005 4:00
1/20/2005 2:00
1/20/2005 3:00
So, I want a SQL code where (date1 minus date 2) is MIN.
Assuming I have linked the 2 tables by their keys and want to bring back on the record where the dates are closest and filter out the rest.
I am thinking a where clause, a CASE clause can do it.
I have a database were a client can have many addresses. Clients may be at one address or another at different time of the year. The table allows for entering a startdate and an enddate for each address. I'm trying to figure out the best way to filter on this to return only the current address. I have tried the Where clause below but I'm not sure this is what i should use. The year is not needed but the datatype is datetime. I think i need to use the startdate also, but I cannot seam to get how to filter this. If anyone has ideas I would like to hear them.
Thank you,
A.Selected=1 AND A.EndDate Is Null OR DatePart(m,A.Enddate) >= DatePart(m,GETDATE()) AND DatePart(d,A.Enddate) >= DatePart(d,GETDATE())
I have a Classic ASP page that provides me a view on Orders posted by customer for a selected month and year from a SQL Server 2000 database. This ASP page has a Stored Procedure that returns the orders posted by month and year. However, my needs are to be able to display the view by month, day and year to month, day and year, For example January 15, 2008 to February 14, 2008.
The current Classic ASP page has a dropdown to select the month and year from this dropdown only displays months and years for the months and years the customer had posted orders.
What Iâd like to know is how to add to the classic asp page the means to input a date range on the fly that would return the report by month, day, year to month, day, year.
I have to filter my report with the date parameter. Custom Dates are comming from the database.
I have to filter with the date just previous Date which user selected as a parameter.
As an example if parameter contains 2/04/2008 , 10/04/2008, 14/04/2008, 16/04/2008 and user is selecting 14/04/2008 then I want to filter the data from just previous parameter i.e. 10/04/2008
I all. In a talbe I've a datatime field. for example it contain '16-4-2007 10:45'. I like to write a SQL that return all record with the date field equals '16-4-2007' (it's not important the time). how to? thank you.
I have a simple ASP.NET application that allows the user to enter a Query in a TextArea and submit that to the database. Queries that contain Integer, String or other filters seem to work fine, but when the Query contains a Date or DateTime I have problems. Here is an example that works fine in Query analyzer but fails when executed in ASP.NET. "select top 10 * from Subscribers where StartDate < '09-03-2002'" In Query Analyzer no problem, in ASP.NET I get this error... Line 1: Incorrect syntax near ';' However if the Query uses '=' instead of a '<' or '' then it works without error "select top 10 * from Subscribers where StartDate ='09-03-2002'" Any help would be appreciated
how to add a date range filter to my database query. I want to be able to enter a date into ("E,6") and have VBA pull data >,= to that date range according to my "OPENED_DATE" dates. My code is pasted below:
I would like to filter records with in effective date and expiration date; If there is no record within that range, then check for grace period records ( effective date -30 days and expiration date + 90 days)
Below is the detailed script for sample data...
declare @tab table ( sno int identity, name varchar(100), EFFECTIVE_DATE date, EXPIRATION_DATE date) insert into @tab (name, EFFECTIVE_DATE , EXPIRATION_DATE ) SELECT 'chandu', GETDATE(), NULL union all SELECT 'chandu', '2014-02-11 00:00:00' , '2014-03-20 00:00:00' union all SELECT 'AAA', '2014-01-11 00:00:00' , '2014-05-11 00:00:00' union all
I'm using an objectDataSource connected to a strongly typed dataset to populate a GridView. I want to be able to show all the records, or let the user to select only those records that expire in a certain month. The expire field is of type date I'm used to all records being returned when a parameter is missing. If I have Select * from table where last=@last, only the records where the last name is 'Smith' will be returned if @last = 'Smith', but all records are returned is @last = "". But that's not how it's working with the date. I'm passing an integer from 1 to 12 in a querystring. I have the equivalent of select * from table where (MONTH([AD ENDS]) = @month)MONTH(datefield) always returns an integer from 1 to 12. If @month is empty, I want all the records to be displayed, but nothing is. If @month is an int form 1 to 12, it works fine. How can I get all the records if no month is selected? Can I have two objectdatasources and programmatically select which one populates the gridview depending on if I want to filter the data or not? Diane
I have this script that I'm trying to filter the results of the Job History to the day prior at 1800 hours.
It return dates prior to what I have in the WHERE clause.
What should the WHERE Clause look like?
USE msdb Go SELECT j.name JobName,h.step_name StepName, CONVERT(CHAR(10), CAST(STR(h.run_date,8, 0) AS dateTIME), 111) RunDate, STUFF(STUFF(RIGHT('000000' + CAST ( h.run_time AS VARCHAR(6 ) ) ,6),5,0,':'),3,0,':') RunTime, h.run_duration StepDuration, case h.run_status when 0 then 'failed'
I'm using an olap cube in a report (dash board). The last "actual" period should be viewed when the user opens the report. I'm using the MDX tail function for that. Once the report is opened the users want to select another period. Then I want to put period as a parameter. But that is not possible since the parameter check box is no longer available when using a MDX filter expression.
I looking for a way of measuring how many MB of outbound SQL data is being transferred during the course of a day from an OLTP instance.  Data is pulled from this server by a DW in the same domain and adhoc via a linked server. I'm looking at perfmon but nit sure if this is the correct tool and if so which counters to use.  I'm looking for the total MB/GB over the period not the MB per sec.Â
I am using SQL Server in a project where I want to fetch the records that were inserted after a time specified in my query.
Suppose 10 records were inserted at 10:00 AM(morning) and 5 were inserted at 10:15 AM( 15 minutes later). I am running a query at 10:20 AM( 5 minutes after the second transaction). I need this query to be such that it selects the records inserted 10 minutes before. So it will show only the records inserted at and after 10:10 AM and willl not show those inserted at 10:00 AM.
Please help me in making such a query.
I am trying and I think that some Date & Time functions will help but still not able to achieve it.
I am attempting to create a stored procedure that will launch at report runtime to summarize data in a table into a table that will reflect period data using an array type field. I know how to execute one line but I am not sure how to run the script so that it not only summarizes the data below but also creates and drops the table.
I am trying to write a stored procedure that will select information from a SQL table based on a specific time. For example I have a name field and a time field, I want to return just the names that were created between a specific time frame. ex between 3pm and 4pm. Any thoughts?
To give you some context we have a new amendments application (nothing fancy, excel based with SQL Server back end) that allows users to submit amendments to product data (Product Info, PO Prices, Dates etc.). There is also an admin tool that a team uses to action these amendments in the various systems.
The old version of this tool, users submitted amendments by style and could if need be submit multiple amendments against one product at the same time. The new tool, I believe for audit reasons, users submit by amendment type, so for example I would submit a cost price change for a given style.
The issue now is that on the occasions where a user has multiple amendments, they now come through separately. So cost price would be Amendment 1 and a date change would be amendment 2 even though they could be the same product. This could potentially mean that the admin team would be duplicating work if the paperwork is updated and sent after each amendment, whereas before they would make both changes and only send the paperwork once.
Having not built either of these tools, I've been tasked with trying to fix this, my two thoughts being either to amend the user form to somehow capture/ allow users to submit amendments together or try to use the existing data and doing the grouping dynamically in the back end. Use that lag to look at grouping any submitted amendments that occur within 30mins of the first occurrence of that style
This grouping would then be given a joint time so when the 'time lag' period passes the amendments will be visible together.I've tried a few things and a few head on desk moments trying to get a set based approach but haven't been able to get where i want, its either an issue where amendments span an hour, such as 9:59 and then 10:03 or grouping together amendments that happen after the 30mins of the first one.
Here is some sample data
USE FF_Winning_Together; IF OBJECT_ID(N'tempdb..#AmendTest',N'U') IS NOT NULL DROP TABLE #AmendTest; CREATE TABLE #AmendTest ( AmendmentIDINT IDENTITY(1,1)NOT NULL, StyleCHAR(1)NOT NULL, AmendmentStatusVARCHAR(10)NOT NULL, DTDATETIMENOT NULL
i would like to see the 2014-06 matched results (3rd query), if the same ssn and acctno is exist in 2012-06 and 2013-06 and 2014-06 then eliminate from results, otherwise show it
select ssn, acctno From jnj.drgSamples where Channel ='KM' and TrailMonth ='2012-06' select ssn, acctno From jnj.drgSamples where Channel ='KM' and TrailMonth ='2013-06' select ssn, acctno From jnj.drgSamples where Channel ='KM' and TrailMonth ='2014-06'
i have written the below query but it shows only matched across three queries, but i want to display / delete from 2014-06 records if the ssn and acctno is exist in 2012-06 and 2013-06
select c.* from ( (select * From jnj.drgSamples where Channel ='KM' and TrailMonth ='2012-06' ) a join (select * From jnj.drgSamples where Channel ='KM' and TrailMonth ='2013-06' ) b on a.SSN = b.SSN and a.acctno = b.acctno join (select * From jnj.drgSamples where Channel ='KM' and TrailMonth ='2014-06' ) C on a.SSN = c.SSN and a.acctno = c.acctno join )
I am facing a strange issue with regards to generation of a report from my application in in Live. One of our client is using a report âAuditors Reportâ. When I try to generate the report for period of 1 month i.e. from 01 May 2015 â 31 May 2015, the report fails when the data is bound to report control. However if I try to generate the report for period of 1 day or 15 days for within the same month, report gets generated.
Now the same application and same database when attached to our local machine, the report gets generated properly for 1 month. I am not sure why the issue is coming on the server.