Viewing 15 posts - 2,206 through 2,220 (of 3,011 total)
Tomm Carr (9/5/2008)
Michael Valentine Jones (9/4/2008)
My solution was specifically meant to be NOT responsive to the setting of DATEFIRST.
Why? The purpose of DATEFIRST is to allow your functions and procedures...
September 5, 2008 at 7:13 pm
My solution was specifically meant to be NOT responsive to the setting of DATEFIRST.
I posted the link in one of my prior posts that has a function for the start...
September 4, 2008 at 9:38 pm
That would be great. SELF JOINS get old fast.
September 3, 2008 at 8:43 pm
This does the same as my last post. It just has the functions calls for SundaysInMonth nested.
select
[Year]= year(a.DT),
[Month] = month(a.DT),
SundaysInMonth =
(datediff(dd,
dateadd(dd,((datediff(dd,-53684,dateadd(mm,datediff(mm,0,a.DT),0)+6)/7)*7),-53684),
dateadd(dd,((datediff(dd,-53684,dateadd(mm,datediff(mm,-1,a.DT),-1))/7)*7),-53684)
)/7)+1
from
( -- Test dates, all months for 2008
select...
September 3, 2008 at 1:43 pm
This shows a different method that only requires a single select statement.
select
[Year]= year(FirstSunday),
[Month] = month(FirstSunday),
SundaysInMonth = (datediff(dd,FirstSunday,LastSunday)/7)+1
from
(
select
*,
FirstSunday =
-- First Sunday of the Month
dateadd(dd,((datediff(dd,-53684,aa.Day7)/7)*7),-53684),
LastSunday =
-- Last Sunday of the Month
dateadd(dd,((datediff(dd,-53684,aa.EOM)/7)*7),-53684)
from
(
select
Day7...
September 3, 2008 at 1:34 pm
Paul Manning (9/3/2008)
Thanks Michael Valentine Jones, I can't say I understand it but that worked perfectly!! 😀
The basic algorithm is to find the difference in days from the earliest...
September 3, 2008 at 12:55 pm
Make sure the tables you are looking at have a clustered index. If there is no clustered index, the table is a heap, and the data itself cannot be...
September 2, 2008 at 7:56 pm
manish.jain (9/1/2008)
Hi,Thanks for your reply,
At this stag i am dumb... i am looking for some other good solution.
Would you please suggest me any other good way?
Thanks
Manish Jain
When you tried...
September 2, 2008 at 7:46 pm
The way you have your query written, you will miss any rows that fall in the last second of the day.
When you query for a date range, it is better...
September 2, 2008 at 7:38 pm
You can use the function on this link for what you want to do.
Date Table Function F_TABLE_DATE
September 2, 2008 at 3:52 pm
ss1011 (9/2/2008)
...This is why we recommend cold backups. We also recommend a scheduler to start/stop our default instance. But I suppose I can look into an...
September 2, 2008 at 11:40 am
This should do what you want
select
Weekending =
-- Find end of week date for week Sun-Sat
dateadd(dd,((datediff(dd,-53684,a.salesdate)/7)*7)+6,-53684) ,
a.line,
sum(a.cost)
from
#DAILY a
group by
dateadd(dd,((datediff(dd,-53684,a.salesdate)/7)*7)+6,-53684) ,
a.line
order by
dateadd(dd,((datediff(dd,-53684,a.salesdate)/7)*7)+6,-53684) ,
a.line
September 2, 2008 at 9:18 am
DBCC INDEXDEFRAG stored procedure
http://weblogs.sqlteam.com/tarad/archive/2004/07/30/1834.aspx
August 25, 2008 at 12:43 pm
You need to look at the type of paging to know if there is a problem.
Running backups can cause paging as the OS allocates file system cache, and this is...
August 25, 2008 at 10:01 am
Viewing 15 posts - 2,206 through 2,220 (of 3,011 total)