I have an item table that tracks changes to the item's value:
item_ID, cal_ID, item_value
The cal_ID is sequential in calendar period order.
Every item has at least one record with a cal ID of 0 and the starting value. When the value changes, a new record is written to the table with the item's ID, the cal_ID of the period in which the change occurred, and the new item value
I need to be able to join this to the calendar so I can get the item value for every item for every calendar period. I'm trying to come up with the join syntax that will give me one record for each cal_ID and item_ID with the item_value that was in effect for that cal_ID
If the item table had a begin and end cal_ID on the record, it'd be a straightforward BETWEEN subquery. But all I have is the begin period.
I've been wracking my brain for five hours. Any suggestions?
Hi Everyone. I’m trying to read data from a databasefile called database.mdf which has a connection string called “ConnectionString1�. The aim is to highlit specific days in my calender. For example if there is an event in my database that day on the calander will be highlited. The database has a columb called “Date� in a table called “Dates�. Please can you help? My knowlade in asp.net and VB is very limited. This is as far as I have gone. (I don’t realy understand the VB part as I have copyed it from somone) I just need the vb code to connect to the database.
Imports System.Data.SqlClientImports System.DataImports System.Data.OleDb Partial Class _Default Inherits System.Web.UI.Page Protected Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As DayRenderEventArgs) If IsExistMeeting(e.Day.Date.ToString("MM/dd/yyyy")) Then e.Cell.BackColor = System.Drawing.Color.Red e.Cell.ForeColor = System.Drawing.Color.Yellow End If End Sub Function IsExistMeeting(ByVal datestring As String) As Boolean Dim constr As String = System.Configuration.ConfigurationManager.ConnectionStrings("ConnectionString1").ConnectionString.ToString() '"your connection string" Dim connection As SqlConnection = New SqlConnection(constr) Dim sqlsel As String = "select count(*) from Dates where CONVERT(char, date, 101)='" + datestring + "'" Dim sda As SqlDataAdapter = New SqlDataAdapter(sqlsel, connection) Dim ds As DataSet = New DataSet() sda.Fill(ds, "Dates") If ds.Tables("Dates").Rows.Count = 0 Then Return False End If Return True End FunctionEnd Class
In master.dbo.sysprocesses I can filter for blocked users (Blocked >0)and I can create a self join(ON SPID = Blocked) to see what userLoginame is causing the block. In the column [cmd] I can see thecommand that the offending blocker is running to cause the block, butit only says "SELECT" etc. with no details about the stored procedurethat is causing the block.If I am running a Trace, I can see the exact stored proceduresincluding the parameters that every cmd is running.Is there a way to see that same Trace information when looking forblocked users in master.dbo.sysprocesses, or in some other place?Ideally what I want is a list of blocked users, who is causing theblocks and the stored procedure name (or other mischief) causing theblock.Any help is appreciated.lq
I am still new to SQL and I am having trouble obtaining the results I need from a query. I have worked on this command for some time and searched the internet but cannot seem to still get it correct.
I have a table called Patient. It's primary key is pat_id.
I have a second table called Coverage. It has no primary key. The foreign keys are pat_id, coverage_plan_id, and hosp_status.
I have a third table called Coverage_History.  It has a primary key consisting of pat_id, hosp_status, copay_priority, and effective_from.Â
I want to get the pat_id and all the coverage information that is current.  The coverage table contains specific insurance policy information.  The coverage_history table will indicate the effective dates for the coverage. So the tables could contain something like this:
Patient (pat_id and lname) P123Â Monto P124Â Minto P125Â Dento P126Â Donto
Coverage (pat_id, coverage_plan_id, hosp_status, policy_num) P123Â Â Â Â MED1Â Â OPÂ Â A1499 P123Â Â Â Â ACT4Â Â OPÂ Â H39BÂ P124Â Â Â Â MED1Â Â OPÂ Â C90009 P124Â Â Â Â RACÂ Â Â OPÂ Â 99KKKK P124Â Â Â Â RACÂ Â Â OPÂ Â 99KKKK P124Â Â Â Â MED1Â Â OPÂ Â C90009 P125Â Â Â Â ARPÂ Â Â OPÂ Â G190 P126Â Â Â Â BCBÂ Â Â OPÂ Â H88
Coverage_History (pat_id, hosp_status, copay_priority, effective_from, coverage_plan_id, effective_to) P123Â Â OPÂ Â 1Â Â 20150102Â MED1Â Â Â NULL P123Â Â OPÂ Â 2Â Â 20150102Â ACT4Â Â Â NULL P124Â Â OPÂ Â 1Â Â 20150203Â RACÂ Â Â Â 20150430 P124Â Â OPÂ Â 2Â Â 20150203Â MED1Â Â Â 20150430 P124Â Â OPÂ Â 1Â Â 20150501Â MED1Â Â Â NULL P124Â Â OPÂ Â 2Â Â 20150501Â RACÂ Â Â Â NULL P125Â Â OPÂ Â 1Â Â 20150801Â ARPÂ Â Â Â NULLÂ P126Â Â OPÂ Â 1Â Â 20150801Â BCBÂ Â Â Â 20160101
select p.pat_id, p.lname, ch.coverage_plan_id, ch.hosp_status, ch.effective_from, ch.effective_to, ch.copay_priority,       from patient p       left join   ( coverage_history ch left join coverage c on ch.coverage_plan_id = c.coverage_plan_id and ch.patient_id = c.patient_id and                                   (ch.effective_to is NULL or ch.effective_to >= getdate() )         ) on ch.patient_id = p.patient_id            where ( ch.effective_to is NULL or ch.effective_to >= getdate() )    So I want to see:
P123 Monto MED1 OP  20150102   NULL      1 P123 Monto ACT4 OP  20150102   NULL      2 P124 Minto MED1 OP  20150501   NULL      1 P124 Minto RAC  OP  20150501   NULL      2 P125 Dento ARP  OP  20150801   NULL      1 P126 Donto BCB  OP  20150801   20160101   1
I want to be able to see when records have been added to a table. The issue is we have a DTS job scheduled to run every night. The developer who wrote it password protected it and doesn't work here anymore. I want to add a step to this series of DTS jobs and want to run it just prior to his job. Is there a way to see when the records are being added or when this job is being run? Thanks again, you guys are the best.
I'm developing a site in asp.net and one of the main parts is to manage a timesheet. Now the problem i'm facing is; how do I save this timesheet in a database in a way that it's easy to save and easy to query from. I'm thinking about problems as i.e. 1st of a month is middle of the week, so I can't save it like this:
I have thought about this, and I cannot in my head come up with a way to create this. Maybe I am thinking about it too much, or maybe it is this difficult and I will need a 3rd party tool.
My users have requested a SQL Reporting Services report that looks like a calendar. Each page will be one month on the calendar. And then the data will fall on the calendar according to a date field in the database. It should not be all that difficult, but I cannot think of a way to acheive this.
Has anyone tried to build a report that is basically just a calendar, and each page is a month of the calendar? If so, did you build it using the standard SQL reporting services tools, or did you purchase a 3rd party vendor?
Hello there I'm having a little issue with Updating a SQL Table. *Deep Breath* OK, lets begin from the start... I Have a Table Called Job. I've an ASP Page setup to insert a new record into the Job table via a DetailsView Control with an SQLDataSource bound to it. This table has many columns in it, 4 of which are DateTime columns. I use a calendar Control from the toolbox for the DateTime selection and bound all the Calender control's SelectedDate to: SelectedDate='<%# Bind('EnteredDate') %>' using the EnteredDate field as my example. I only insert DateTime Values into 2 of the 4 DateTime columns in the original INSERT, so the remaining 2 columns are NULL. I have an UPDATE setup on a different page to edit the previously inserted rows in job using another SQLDataSource again using the bind method for calendars: '<%# Bind('RevisedDate') %>' My Problem is (according to this post I found online http://www.thescripts.com/forum/thread529052.html ) the page crashes with "Specified cast is not valid". The reason being I'm trying to bind to the remaining 2 NULL DateTime columns in an attempt to update them with a value my user will not be able to insert in the original INSERT. The solution Code I found on the link above is in VisualBasic and I have had little luck in trying to convert it into C# to even see if it solves my problem: VB Code: Function FixDBNull(ByVal inVal As Object) As DateTime If inVal Is DBNull.Value Then Return DateTime.Now Else Return inVal End IfEnd Function ASP Code: <asp:calendar id="calEditRevisedDate" runat="server"selecteddaystyle-backcolor="red"selecteddate='<%#FixDBNull(eval("RevisedDate")) %>'visibledate='<%# FixDBNull( eval("RevisedDate")) %>'selectorstyle-backcolor="Green"></asp:calendar> Any suggestions or work arounds would be greatly appreciated Thank You
I have 2 dropdownlist and a gridview. The dropdownlists filter the gridview, but now I have added two calendars and two textboxes. After user makes selections from the calendar the text boxes are populated with the dates. How do I add this to the following select parameter so that the filtering/querying works properly? (what I have here does not work in terms for the dates, but dropdownlists filter when I remove the dates section):<asp:SqlDataSource ID="DATA" runat="server" ConnectionString="<%$ ConnectionStrings:DATA_Connection %>" SelectCommand="SELECT * FROM [atable] WHERE(afield=@param1 or @Param1='Select something' or((CONVERT(char(10), adate, 101)>=@param3 AND CONVERT(char(10), bdate, 101)<=@param4)) AND(bfield=@Param2 OR @Param2='Select something' or((CONVERT(char(10), adate, 101)>=@param3 AND CONVERT(char(10), bdate, 101)<=@param4))" UpdateCommand="Update atable set afield=@afield, bfield=@bfield where id=@ID" > <selectParameters> <asp:controlparameter name="param1" controlid="DropDownList1" PropertyName="SelectedValue" type="String" /> <asp:controlparameter name="param2" controlid="DropDownList2" PropertyName="SelectedValue" type="String" /> <asp:ControlParameter Name="param3" ControlID="Textbox1" PropertyName="Text" Type="string" /> <asp:ControlParameter Name="param4" ControlID="Textbox2" PropertyName="Text" Type="string" /> </selectParameters>
We have developed several reports using VS 2005 and deployed them to our SQL 2005 reporting server. As most of our reports use date parameters we would like to incorporate a calendar control to allow users to select their date range as opposed to typing them in. I have done some reseach online but can only find vague references on how to do this. Has anyone out there been able to successfully deploy a calendar control onto an SQL report? Thanks!
I'm looking for a function that will return an INTEGER that computes the number of days between two dates based on a 360-calendar year instead of using just the datediff function which is actual days.
If anybody knows where I could find something like this, I would be greatly appreciated.
Does this site have a library of user-defined sql functions? Or, does somebody have a site that you know of where there are a bunch?
i have inherited a sql database to work on and cannot seen to fix this error. its an availability calendar and at the end of each month a new month is generated, it by default makes all dates unavailable but i need them available. is this done in the database as a default??if a member has logged in recently then the avails populate fine but if they have not logged in for a while then they all show unavailable? i
HelloMy department has a SQL server database that is used to all facets ofproduction within our department. This includes key production jobsteps, project names, numbers and descriptions.The calendar is currently done manually as an Excel document. The userrecieves hard copies of the required information, then keys it into theappropriate place on the Excel document.We would like to pull information out of that database, and put it in amonthly calendar format. For example, take a project name and the dateassociated with that project, and put it on a calendar in theappropriate date "square".If you have information or experience with software that can be used toaccomplish this task, I would appreciate hearing your advice.Thanks in advance.
Hi!I have a query that has to return bunch of data based on the calendarmonth. I have to make sure that it will return data to me for 28 daysif it is February and for 31 if it is August(for example). I need tobe able to execute it every first of every month for the past 30, 31 or28 days based on the calendar month. Is there a function or a storedprocedure that I can use to do that?Thank you,T.
Hello all, I would like to populate a calendar table similar to the one used in the foodmart2005 sample database. In this table the day of the week, month, and year are recorded as well as additional data which I do not require. If possible I would like to populate the table with 10 years of data starting with 2007.
Secondly would 10 years of data make the table to large?
Blank Field Blank Field Blank Field Blank Field Blank Field Blank Field Blank Field
The user would enter the start date, in this case the 1st Jan 07 and then this would populate a table. This seems like it should be so simple but I can't work it out, can anyone help please?
I'm working on a project where a user wants to show there scheduled events on a calendar.
The way they want to show it is, displaying a bar across the days that the event takes place.
They want this on a web page and in Word. I'm using VFP 9.0 and I know it has web tools, but I've never used them. Could someone please point me in the right direction of how to do all of this?
I have 3 parameters in the report. When user selects 1st one from dataset, one of the fields gives me object creation date. Calendar control is supposed to be filtered to allow users select the dates greater than selected one.
How can I filter (disable dates in) calendar control?
The Calendar control that is used to select dates on a parameterized report that runs on a report server has been disabled for Safari. Users must type the dates that they want to use. http://technet.microsoft.com/en-us/library/ms156511.aspx
Does anyone know the reason why this was disabled? Will/Can it be enabled? I have clients that desire this functionality. How do I "Make a Suggestion" for the next release?
I have a DateTime parameter called End Date set up with a default value eg =DateAdd("s",-1,Today). When I preview, the default value appears as 19/09/2006 23:59:59, which is fine.
However, when the report is deployed, it is displayed as 19/09/2006 11:59:59 PM. This would also be fine, except when the user changes the date using the calendar, it converts the time back to 24 hour time - eg 19/09/2006 23:59:59. Then when the report is run, it converts the time format back to AM/PM again.
Also, I have a Start Date Parameter, with a default value of 12:00AM today. I would like this to be displayed as 19/09/2006 12:00AM in the Start Date parameter text box, however reporting services will not display the 12:00AM part. Using FormatDateTime in the Default value will return a string and cause an error. I don't want to change the parameter to a string and lose the date picker.
Any ideas,
Thanks
PS Getting the Date/Time settings changed on the reporting server would be extremely difficult!
hi folks:imports system.data Private schedule As New DataView() Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender schedule = CType(srcSchedule.Select(DataSourceSelectArguments.Empty), DataView) schedule.Sort = "entryDate" End Sub///////////////////////whenever i run the above code an error message comes up with the following message:Object reference not set to an instance of an object.and it highlights the bold message mention in the code. I wanted this code to highlight the dates in the calendar that have events on them.Can you please help. thank you very much in advance.
Hi,I m trying to implement a calendar, where you can select certain dates and view list of events for that day. The list is generated from database. I found a script on the web that is quite similar to what i want to achieve. I tried to run this script, however I get an exeption saying:An error has occurred while establishing a connection to the server. .... error: 40 - Could not open a connection to SQL Server)This is the code:SqlConnection mycn; SqlDataAdapter myda; DataSet ds = new DataSet(); DataSet dsSelDate; String strConn; private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here strConn = "Data Source=localhost;Initial Catalog=pubs"; mycn = new SqlConnection(strConn); myda = new SqlDataAdapter("Select * FROM EventsTable", mycn); myda.Fill(ds, "Table"); //This where I get the exeption } protected void CalendarDRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e) { // If the month is CurrentMonth if (!e.Day.IsOtherMonth) { foreach (DataRow dr in ds.Tables[0].Rows) { if ((dr["EventDate"].ToString() != DBNull.Value.ToString())) { DateTime dtEvent = (DateTime)dr["EventDate"]; if (dtEvent.Equals(e.Day.Date)) { e.Cell.BackColor = System.Drawing.Color.PaleVioletRed; } } } } //If the month is not CurrentMonth then hide the Dates else { e.Cell.Text = ""; } } private void Calendar1_SelectionChanged(object sender, System.EventArgs e) { myda = new SqlDataAdapter("Select * from EventsTable where EventDate='" + Calendar1.SelectedDate.ToString() + "'", mycn); dsSelDate = new DataSet(); myda.Fill(dsSelDate, "AllTables"); if (dsSelDate.Tables[0].Rows.Count == 0) { DataGrid1.Visible = false; } else { DataGrid1.Visible = true; DataGrid1.DataSource = dsSelDate; DataGrid1.DataBind(); } } Can some one tell me what is wrong with the code.Thank You WATCH THIS SPACE
I'm running SSRS reports on my local server - having deployed them locally. The calendar control is rendering dates in US format, i.e. 03/31/2008 and I need the British format of 31/03/2008.
The weird thing is that when I access the reports using the link:
produces the US format. My Regional setting is using English UK and the server is British English. What on earth is going on here? By the way cbada00272 is synonymous with localhost.
I've been scratching my head on this for quite awhile and it has me stumped.I hope to define a query which I can use to fill a "day planner" type ofcalendar. Although I've see a lot of these, only one has had what I thinkis a really nice feature - it collected into groups all events thatoverlapped into contiguous blocks of time. The net result of this is thatit becomes possible to output a calendar (html table) that is much lesscluttered. So I want to use this same idea for my own little project.The trick is that events may (or may not) start and end such that theyoverlap (completely or only at one end). I only am concerned with events ona given day.My "events" table contains eventtitle, date,starthour and endhour. Hoursare numbered from "0" to "23". I also have a lookup table of the "hours ofthe day" with which I did a JOIN to include the "missing" hours (where therewere no events - making a query that returned events for each hour and nullsfor each hour that had no event scheduled for it. But this makes too many"blank" rows, which is part of the clutter to which I referred.I've been able to construct queries that work in some cases, but not all.I've reread my copy of Celko's SQL For Smarties and came close, but nocigar. Where he discusses hotels and room-nights is part of the solution Ineeded, but my need goes beyond that quite a bit.Basically, I need to calculate one or more "spans" that contain contiguousgroups of start/end times. By knowing the number of hours spanned, I canthen use that for a <TD rowspan='n'> to collect my data like I want.I seem to keep hitting all around the solution. Maybe there isn't one (thatis purely a SQL solution). Or maybe I'm just looking at the problem thewrong way.So I thought I'd see if anyone here might point me in the right (or at least"new") direction. I've been looking at this for so long, I'm probablyoverlooking some simple and obvious trick to do this. Or maybe I'll getlucky and someone has seen or done exactly this already and can provide asolution?Incidentally, I've avoided utilizing a stored procedure or making a numberof temp tables to collect intermediate results, as I might need to port thisto a "dumb" database that does not provide such facilities. Maybe that'simpractical?thanks in advance,--
I am trying to find the best way to use a date parameter on a OLAP report and get the calendar pop to be used instead of a dropdown.
Whenever I change from string to datetime for the parameter I (of course) get an error about different data types, since OLAP is returning the fields as strings and formatted.
Any easy (or best) approach to use to get a calendar pop to work with an OLAP report? I am mainly doing this for date range searches and do not want people to pick from huge dropdowns for dates.
I have tried different techniques to design the report but no luck,
1) design staff 5 days schedule as a calendar between two dates and 2)each staff can have more than one schedule on the same day. 3)Only one staff per page. 4) week will start based on date  ex: for staff 2 calendar will start based on date.
Wednesday  Friday    Tuesday   Wednesday   Thursday 01/01/14   3/01/14   7/01/14   8/01/14      9/01/14
Sample data:
expected format:
Staff1 (page 1) Monday    Wednesday   Friday   Monday 13/10/14  15/10/14  17/10/14  20/10/14
Staff 2 (page 2) Wednesday  Friday    Tuesday   Wednesday   Thursday 01/01/14   3/01/14   7/01/14   8/01/14      9/01/14
(page 3) Saturday    Wednesday  Thursday   Friday     Wednesday 11/01/14   15/01/14   16/01/14   17/01/14    22/01/14 and so on....
I'm building a cube for sales team , to test out I'm trying to process just one dimension called DimCalandar , when I try to process this dimension I get the following error ,
'Either the user abc/def, does not have access to database, or the database does not exist'Â ...