October 27, 2008 at 12:58 pm
I am working on an asp.net project to create a web based time sheet application.
I want to be able for the end user company to customize the start day of a pay period.
So if company A starts their pay periods on say a wednesday if a user were to login it would list the 7 days of the week
stating on wednesday and ending on tuesday.
I would want this to be based on a variable so if one company had a start day of wednesday and another had a start period on a friday.
I would thing i could somehow set the variable in the application of the web config. Not sure of that is the best way to do it.
I really don't know how to proceed on this.
October 27, 2008 at 9:13 pm
Take a look in BOL for SET DATEFIRST. NOte that setting this inside sprocs causes a recompile event. Another possiblity is to store the start of the week for a given client in a table column and then do math to get what you need. I don't think there is a 'clean and efficient' way to do what you ask tho. 🙁
Best,
Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru on googles mail service
October 31, 2008 at 10:45 am
Gail,
I agree with the SQL Guru. However, setting the first day of the week in SQL Server is not really an option - it's way too messy. Keep this in a company profile table.
Todd Fifield
October 31, 2008 at 7:25 pm
It's a good thing to have, anyway... make a Calendar table based on the user inputs.
--Jeff Moden
Change is inevitable... Change for the better is not.
October 31, 2008 at 8:26 pm
Sounds to me like that should be something stored in the user profile table (a.k.a when does their week start?).
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
November 1, 2008 at 10:16 pm
ok I will keep this in mind. I have not got to the point to work on this part yet, but I will check back here when I am at that point. When you talk about the profile you refferring to the asp.net prfile database i assume?
Thanks for the tips i will look you up when i am to that point. I was just putting some feelers out there for now.
Thanks!
November 3, 2008 at 7:21 am
If the website will serve multiple companies, I would think that there would need to be a table containing company-specific data, and that each company could then have it's own "starting day of the week", which could just be the day number that a setting of SET DATEFIRST 1 would normally map the weekdays to - Sunday 1 thru Saturday 7.
I don't really see that kind of setting as being user specific, as it seems unlikely a single company would have employees with differing starting days of the week. Just my two cents on it...
Steve
(aka smunson)
:):):)
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
November 5, 2008 at 7:01 am
this seems very logical to me. where would i do the setdatefirst? within a select query or some other variable? assume if i setdatefirst=3 then start day would be tuesday etc correct
November 5, 2008 at 8:03 am
My Bad !!! I have the DATEFIRST thing messed up. Take a look at the BOL (Books Online) topic here:
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/6b0d0e52-8ac1-4f88-b091-f98d6fb8574a.htm
(just copy and paste the above text into the URL box in the Help window)
That will explain how it works. I was just trying to explain about the default values. My point isn't that you would necessarily need to use a SET DATEFIRST statement (although you certainly could), but just that by storing which day of the week is the 1st workday in a week for a given company in a table, you can then use that information to calculate things as needed.
Steve
(aka smunson)
:):):)
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply