Viewing 15 posts - 106 through 120 (of 129 total)
declare@max-2 int
set@max-2 = 240
select *
from (
select '2010-01-01 10:00:00' [time]
union all
select '2010-01-01 11:00:00'
union all
select '2010-01-01 12:00:00'
union all
select '2010-01-01 13:00:00'
union all
select '2010-01-01 14:00:00'
) blah
where[time]
betweendateadd(minute, -@max - 120, getdate())
anddateadd(minute,...
July 6, 2010 at 11:22 am
Is your composite index sequential, and the columns never update?
because it needs to be to work well as a clustered index ...
you can also use ASC DESC to ensure the...
July 6, 2010 at 5:29 am
I think there are 325 distinct non-clustered indexes to choose from
given 5 columns - if you ignore the ASC DESC options
some examples:
create index IX_Blah
on dbo.Table (a, b, c, d, e)
create...
July 5, 2010 at 8:49 am
sp_who
sp_who2
kill
alter database set single_user
use master
exec dbo.sp_detach
July 5, 2010 at 8:33 am
Eugene Elutin (7/5/2010)
Lets...
July 5, 2010 at 8:21 am
the primary function of the IsPaused column is "is this session paused"
the secondary function of the IsPaused column is "if this session is paused - when was it paused"
that is...
July 5, 2010 at 5:59 am
I would not recommend such table design for logging details in OLTP system. It looks more like a table from reporting database, where the data needs to be denormailized.
Just think...
July 4, 2010 at 5:18 pm
even simpler and more efficient is to use a single record per session:
create table dbo.TimeLog (
[TimeLogID] int identity
,[EmpID] int not null
,[LoginTime] datetime not null
,[LogoutTime] datetime
,[PauseDuration] int not null
,[SessionDuration] int not...
July 4, 2010 at 3:22 pm
I don't like complex queries over large datasets when you can easily cache the data:
declare @timeLog table (SNO int, EMPID int, [STATUS] char(10), [DATE] Datetime, [DURATION] int)
the logout logic would...
July 4, 2010 at 4:02 am
all the information you need is available within the function
so adjust for the error introduced by @@datefirst
I think this would work:
create functiondbo.fnWeekDay(@Now datetime, @DateFirst int)
returnsint
begin
--
return((datepart(weekday, @Now) + @@datefirst - @DateFirst...
July 3, 2010 at 6:08 am
an idea:
funnel all inserts and updates to the lookup tables via stored procedures
and use a transaction to update tables across all databases
this would give you all the benefits of the...
June 26, 2010 at 1:23 am
what have you learnt?
never make any changes to production systems after lunchtime or after thursday
build LOTS of constraints / checks / safe guards into your apps / db
make a testing...
June 23, 2010 at 3:21 am
I believe the locking system in SQL Server
was designed for old fashioned applications
that opened and held long lived connections and locks
they *had* to use high resolution locks or they wouldn't...
June 14, 2010 at 1:01 pm
it is a ridiculous system - anybody can judge a person by their forum posts
we do not need Microsoft's help
and to be motivated by gaining MVP status? come on ...
February 8, 2010 at 7:07 am
Viewing 15 posts - 106 through 120 (of 129 total)