Calculating And Storing Alternative Calender/dates
Jul 20, 2007
Hi Engine room.
I want to automatically populate an alternative date column with hijri (Arabic) dates. So I will have two date columns in my datawarehouse table, one is for gregorian dates, the other for the equivalent in Hijri - a bilingual date system if you like. Now I guess I could do it in the SSI ETL tool and use Julian Dates, but the problem is storing the resulting value. - what data type should I use for hijri dates?
The dates can be input by the user in either format, which means the alternate date has to be populated.
Eventually I hope to make a bilingual system, I don't understand the user-defined types or how to define them, but I suspect they could be used in someway to help. Why am I doing this? - well eventually I hope to populate a cube for analysis and deliver a dual-language-dashboard using the new CTP3 stuff.
Any suggestions on how I can make this dual-date system? - with a view to making a bilingual system eventually.
adv(thnx)ance..Mark.
View 1 Replies
ADVERTISEMENT
Feb 3, 2006
Hi,I was wondering what anybodies feelings on storing images and files in SQL server express 2005?I am guessing it is a No No...If this is the case what are the best practices for achieving this?Would something like a table which held the "real name of the file", "a unique identifier" do the trick...hence in code (c#) i could create a GUID for the unique identifier maybe??? and then upload the pictue or file to a common directory and name it with the unique identifier rather than its real name.This means that i could potentially hold a different file with the same name i.e. no conflictsMy app is a sort of HTML editor in asp.net (all html is stored in the db) so if i do upload a picture using a GUID or uniquee identifier then if somebody saves teh image from a webpage then it would be called uniqueIdentifier.jpg which is probably what i don't want.So the only other idea i had was to create a directroy within my site which I would name with the unique identifier and upload the pics and files with thier real names into this directory. Hence each document would have its own directory so there would be no conflicts with filenamesAny advice or comments really appreciatedThanks in advanceIan
View 3 Replies
View Related
Dec 19, 2007
Hi, I'm in the process of creating a database table and was wondering if it's better to store calculated values or recalculate them each time. So for example, I am creating a table that stores articles and then a table to store the pages to the article. If a new page is added should I update the pages field in the articles table or should I calculate the number of pages for an article when it's queried? Thanks,John
View 3 Replies
View Related
Aug 26, 2005
Hi,
I'm fairly new to MS SQL, but I'm trying to query the time elapse between two dates. Example below...
Select
dbo.res.book_date,
dbo.res.arrive_date,
Cast (dbo.translog.systemdate as datetime)
From
dbo.res
Where
dbo.res.resid > '500'
The third line is where I need help with a statement. I need the elapse time. Ex. if the book date is 20050820100000 and the arrive date is 20050820120000, I would like the third Select statement to return 2:00 hours or something similar. Thanks.
View 11 Replies
View Related
May 16, 2004
I have a table in my sql server that calculates renewal dates for me, that date is based on the final suit date. The table has the ssn, and the FinalSuitDate its in a one to many relationship with the employeetable.
the Finalsuit table is suppose to calculate the renewal dates(which I'm trying to do in a query) my original expression in access was using dateserial FirstRenewal: DateSerial(Year([FINALSUITDONE])+2,Month([FINALSUITDONE])+1,Day([FINALSUITDONE])=30), but sql does not recognize that.
For Example
If the Finalsuit is 12/01/2000
then the renewal would be 12/31/2002
the renewal are to be done on the last day of the month and two years from the finalsuit date. Problems is I'm having problems doing this in sql servers query?
Can someone out there help please
View 8 Replies
View Related
Nov 1, 2007
I have a project where I need to populate a table with a Begin and an end date based on another field with in the table. my example is that the other field will have a value of "monthly" I want then a record to be entered on the table with a begin date of November 1 and the en date as November 30th. I want this record to get populated only on business days. my thinking is a stored procedure that runs daily and only creates a record at a time. i am thinking if the user selects weekly the dates populated would be november 1 = begin date and Novemeber 2nd = end date
i want to fill out a current month at a time as if the account closes i will not need the extra cases.
thanks
Don S
View 5 Replies
View Related
Dec 9, 2011
I have data in which i need to calculate employees working hours for a day...
name time in_out
manisha 2011-01-01 9:30:00.000am 1
manisha 2011-01-01 10:30:00.000 0
manisha 2011-01-01 10:45:00.000 1
manisha 2011-01-02 1:00:00.000am 0
How can i calculate time in that two dates as 1 is for entry an 0 is for exit..
View 2 Replies
View Related
Jul 12, 2000
Hello,
Can anyone out there tell me if there's a simple way to calculate the number of week days between two dates in TSQL? Need it to calc. average turnaround times, excluding weekends. Can do it v. easily in VB, but gets a little more tricky in TSQL as there's no way to return the number of Sundays and Saturdays between the two dates. Any help much appreciated !
Jon Reade
Sql Server DBA
NEC Technologies (UK) Ltd.
View 2 Replies
View Related
Jul 12, 2000
Hello,
Can anyone out there tell me if there's a simple way to calculate the number of week days between two dates in TSQL? Need it to calc. average turnaround times, excluding weekends. Can do it v. easily in VB, but gets a little more tricky in TSQL as there's no way to return the number of Sundays and Saturdays between the two dates. Any help much appreciated !
Jon Reade
Sql Server DBA
NEC Technologies (UK) Ltd.
View 1 Replies
View Related
May 22, 2014
This function will return working hours between given 2 dates. This function assumes that the break is between 9:45 AM and 10 AM and that Lunch is between 12:30 PM and 1 PM. This function also assumes that the working hours are between 7:30 AM and 4 PM. There is a section for public holidays there. We have a table for that you might not so that piece needs to be fixed.
CREATE function [dbo].[fnc_myHinkley_ASSY_CalcWorkingMinutes] (@StartDate datetime, @EndDate datetime)
RETURNS decimal(14,2)
/*
Programmer: Goran Borojevic
Date: 5/14/2014
This function will return working hours between given 2 dates. This function assumes that the break is between 9:45 AM and 10 AM and that Lunch is between 12:30 PM and 1 PM. This function also assumes that the working hours are between 7:30 AM and 4 PM.
*/
AS
BEGIN
--check if one of the dates is null
if @StartDate is null or @EndDate is null
RETURN 0
[code]...
View 9 Replies
View Related
Oct 1, 2006
Hi,
I am having problems when storing dates in Sql 2005 from vb.net, I use a SqlCommand like this:
Dim xSQL As New SqlCommand(strSave, Conn)
xSQL.ExecuteNonQuery()
Inside the strSave string there is a DateTime value, all values are stored ok, but the saved date in the SQL server is always 1900-01-01 00:00:00.000
The SQL data type in database is datetime.
Any help would be eternally appreciated.
Thanks in advance.
View 5 Replies
View Related
May 1, 2007
Ok, so I've been struggling with the logic behind this one for a while, so I thought I'd ask you guys for some ideas :)
Basically, I have the following table structure
Employee(employee_number, continuous_start_date, ...)
The problem lies in working out a summary of service categories (0-6months, 7-12months, 13-24, 25+).
I can work out the length of service in months with the following code
SELECT DateDiff(mm, continuous_start_date, GetDate()) AS 'Service in months'
FROM employee
So the first stage is to summarise the length of service into groups as mentioned above.
Then the final stage is working out how many people are in each group!
Hope I have given enough information - and please do not post a full solution - just some hints on how to get the desired result ;)
Thanks later, and in advance :p
-GeorgeV
View 14 Replies
View Related
Aug 19, 2014
I need a Query for calculating the fiscal_week based on the input dates (start_date and end_date), though I got a query from this forum, it is not giving me exact result.
the sample is in the excel file with the attachment.
In the excel:
First tab tells you the raw_data what I am using to find the Fiscal_week
Second tab tell you the data where i found the mistake, and how I am expecting the output.
I also have attached the query I have got from this forum, query I have modified for fiscal week.
View 4 Replies
View Related
Nov 13, 2015
I am working with a data set containing several years' of monetary values. I have entries for past dates and the associated values, and I also have entries for future dates. I need to populate the values of the future date records with the values from the same date the previous year. Is there any way this can be done in Power Pivot?
View 6 Replies
View Related
Jan 7, 2014
I have an SQL code below which removes weekends and non working days when calculating days difference between two dates:
ce.enquiry_time represents when the enquiry was logged
(DATEDIFF(dd, ce.enquiry_time, getdate()) + 1)
-(DATEDIFF(wk, ce.enquiry_time, getdate()) * 2)
-(CASE WHEN DATENAME(dw, ce.enquiry_time) = 'Sunday' THEN 1 ELSE 0 END)
-(CASE WHEN DATENAME(dw, getdate()) = 'Saturday' THEN 1 ELSE 0 END)
-(SELECT COUNT(*) FROM nonworking_day WHERE nonworking_day.nonworking_date >= ce.enquiry_time AND nonworking_day.nonworking_date < dateadd(dd,datediff(dd,0,getdate()),1))
It works but I don't understand how it works it out. I am having issues understanding each coloured piece of code and how it works together.
View 1 Replies
View Related
Feb 7, 2008
I have successfully created a calender in VS2005 and it is attached to a access database in app_data called db1.mdb, when you click on a date which has an entry, the value is seen under the calender using grid view.
Does any one know what vb code I need to get the calender to highlight dates which has entries?I it impossible as it is now to tell if there is an entry on a date with out clicking on the date.
Thanks
GLJ
View 1 Replies
View Related
Jun 25, 2002
Whats the quickest way of building a calender split by day,month,year,day name of week. l want populate the table with that information.
View 1 Replies
View Related
Apr 25, 2008
I have calenders activated in our reports.So, I want only those date values to be enabled for the year I am selecting . Is there any option for that?????
View 1 Replies
View Related
Apr 12, 2007
I created a reoport using wizard.In my quesry i took two date parameters.But when i run my report i get two texboxes StartDate and EndDate.How do i get calender button in front of the text boxes.Below is my query.
SELECT dbo.tblReferralTransferStatus.RefId
FROM dbo.tblReferralTransferStatus INNER JOIN
dbo.tblDownloadTracking ON dbo.tblReferralTransferStatus.VendorId = dbo.tblDownloadTracking.VendorId AND
dbo.tblReferralTransferStatus.DateModified < dbo.tblDownloadTracking.DateModified INNER JOIN
dbo.tblVENDOR ON dbo.tblReferralTransferStatus.VendorId = dbo.tblVENDOR.VendorId
WHERE (dbo.tblVENDOR.VendorName = @vendorname)AND (dbo.tblReferralTransferStatus.DateModified >= CAST(@StartDate AS varchar)) AND (dbo.tblReferralTransferStatus.DateModified < CAST(@EndDate AS varchar))
View 1 Replies
View Related
Feb 13, 2007
Hi,
I am using Asp.net Calender in my application and i have two date (i.e StartDate and EndDate). I need to enable dates between these two date in calender.
So the user can choose date with in this set of date.
Can any one give me idea to solve this problem
Thanks,
View 1 Replies
View Related
Dec 29, 2006
Hello there,I just want to ask if storing data in dbase is much better than storing it in the file system? Because for one, i am currenlty developing my thesis which uploads a blob.doc file to a web server (currently i'm using the localhost of ASP.NET) then retrieves it from the local hostAlso i want to know if im right at this, the localhost of ASP.NET is the same as the one of a natural web server on the net? Because i'm just thinking of uploading and downloading the files from a web server. Although our thesis defense didn't require us to really upload it on the net, we were advised to use a localhost on our PC's. I'll be just using my local server Is it ok to just use a web server for storing files than a database?
View 6 Replies
View Related
Mar 2, 2006
SQL 2005 Dev
How can I do this with Parameters? I can get a single parameter to filter for a single date (or even a combo list of the dates in DB). But I want my parameters to interact so that they specify a range. Is this possible?
View 3 Replies
View Related
Jul 18, 2014
Today I have got one scenario to calculate the (sum of days difference minus(-) the dates if the same date is appearing both in assgn_dtm and complet_dtm)/* Here goes the table schema and sample data */
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[temp_tbl]') AND type in (N'U'))
DROP TABLE [dbo].[temp_tbl]
GO
CREATE TABLE [dbo].[temp_tbl](
[tbl_id] [bigint] NULL,
[cs_id] [int] NOT NULL,
[USERID] [int] NOT NULL,
[code]....
View 9 Replies
View Related
Feb 28, 2015
I have a table that has hotel guests and their start stay date and end stay date, i would like to insert into a new table the original information + add all days in between.
CREATE TABLE hotel_guests
(
[guest_name] [varchar](25) NULL,
[start_date] [date] NULL,
[end_date] [date] NULL,
[comment] [varchar](255) NULL
[code]...
View 7 Replies
View Related
Jul 30, 2007
Hi,
i am using the DTC in my code to connect to two different servers on the network through a SQL query which is unfortunately very slow; can u please guide me with an alternative for the same
Thanks
View 17 Replies
View Related
Jul 20, 2005
SELECT *FROM organizationWHERE (departmentID = divisionID) AND (divisionID = branchID) AND(branchID = sectionID) AND (sectionID = unitID)Is there anyway I can make this query more simlified w/o repeating thesame column in the where clause?thankss/RC
View 3 Replies
View Related
Dec 30, 2007
Hi everyone,
I'm trying to come up with a replacement for @@IDENTITY, because I have SQL code I want to make more portable.
Original:ID = MyDataLayer.Execute("INSERT INTO X(a,b,c) VALUES(A,B,C); SELECT @@IDENTITY")
Proposed solution:
lock(MyDataLayer)
ID = MyDataLayer.Execute("SELECT MAX(id)+1 FROM X")
if(ID==null) ID=1
MyDataLayer.Execute("INSERT INTO X(id,a,b,c) VALUES(ID,A,B,C)")
unlock(MyDataLayer)
(This is of course pseudocode, for SQL Server I'd need SET IDENTITY_INSERT.)
Do you think the preceding solution is equivalent to the original?
Do you know something better?
Equivalent should mean here, not necessarily generating the same ID's,
but maintaining functionality and consistence all over the database.
View 9 Replies
View Related
Apr 7, 2004
is there a way to get around not using USE in a PROCEDURE?
I need to because I have a main site that inserts information into other DB's that i use for various subdomains. But without being able to use USE i cant select which database is needed.
thx in advance
View 2 Replies
View Related
May 14, 2001
Hi!
I wrote a query in MS-ACCESS using IIF. Is there any way to convert it to SQL Server Query to do the same job as it do in MS-ACCEESS
e.g. Here is manipulation with one column that I did in MS-ACCESS
IIf(InStr(1,Destinations.[Destination Name],"-",1)-1<0,Destinations.[Destination Name],Left(Destinations.[Destination Name],InStr(1,Destinations.[Destination Name],"-",1)-1)) AS COUNTRY,
View 1 Replies
View Related
Jan 26, 2004
My company develops software that is distributed to thousands of customers. We chose MSDE as the database engine. Over the past 4 months, we have spent countless hours with customers, Microsoft, Installshield and web searches trying to resolve issues with installing MSDE. The issues seem to vary by customer and most take a great deal of support time. We understood MSDE to be a product that requires little support but in hindsight, it appears that it requires a great deal of knowledge just to get installed. We make small steps but no leaps forward.
It has come time to evaluate other products. If there is a magic bullet, I would love to hear about it. In its absence, does anyone have success to share with other products?
Phil
View 13 Replies
View Related
May 2, 2008
Hi,
Just curious, is there any alternative to SQLXMLBULKLOAD for shredding and loading very large (800 megs) XML files ? Due to the nature of the XML data sent to me (which I have no control over)I am having great difficulty loading data into tables. More specifically, I can load parent data but not the child data beneath it despite using sql:relationships.
Thanks,
Jeff
View 2 Replies
View Related
May 21, 2008
I have a situation where my SQL works everywhere else but my COBOL compiler complains wherever I use PARTITION BY. I can't find a workaround for that problem so I would like to remove all the PARTITION BYs. I'm not confident that I can do this accurately and would like some help getting started.
Here is my simplest example:
SELECT FESOR.REGION, FESOR.TYPE,
COUNT(*) OVER (PARTITION BY FESOR.REGION, FESOR.TYPE)
FROM FESOR, FR
where FESOR.phase = 'Ref'
and FESOR.assign is null
and FESOR.comp_date is null
and FESOR.region = FR.REGION
and FESOR.type = FR.TYPE
and FR.REP_ROW='A'
GROUP BY FESOR.REGION, FESOR.TYPE
What I'm looking for is a modified version of the SQL above which returns the same result set without using PARTITION BY.
Thanks in advance for your assistance.
View 20 Replies
View Related
Mar 30, 2006
Hi,
In a stored procedure I'm processing, via a cursor, a table of, potentially, 100,000 rows on a daily basis. The only column in each row is a 12-byte transaction control number. I know that using cursors can cause performance issues. Is there an alternative to using a cursor that has less of a performance impact ?
Thanks,
Jeff
View 5 Replies
View Related