Viewing 15 posts - 1,471 through 1,485 (of 1,489 total)
Ryan Randall's solution:
select cast('1 ' + 'February, 2004' as datetime)
August 10, 2006 at 9:27 am
On quickly looking at this, there is no join condition between ASP_MASTER and the other tables. This will produce a cartesian product; not at good idea!
You could probably optimise this...
August 10, 2006 at 4:11 am
If possible, try and get at least two example dates and values. Maybe 2006-08-09 = 732503 and 2006-08-08 = 732502
You should then be able to work out if it is a...
August 9, 2006 at 8:26 am
I have used application locks for this sort of proc. The idea is similar to using a table except everything is in memory. The outline code is:
-- start of proc
exec...
August 8, 2006 at 3:10 am
Opps...
select ceiling(sum(datediff(minute, tStartTime, tEndTime))/60.0)
from ( select case when tStartTime < @reportStart
then @reportStart
else tStartTime
end as tStartTime
,case when (tEndTime > @reportEnd OR tEndTime IS NULL) --!!!!!
then @reportEnd
else tEndTime
end as tEndTime
from @t
where tEndTime >...
July 26, 2006 at 10:50 am
Answered recently:
http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=8&messageid=296735
July 26, 2006 at 10:08 am
or something like:
declare @t table
(
nPK int not null
,nJobID int not null
,tStartTime datetime not null
,tEndTime datetime null
,lJobOpen bit not null -- is the needed if tEndTime is null?
)
insert @t
select 1, 1,...
July 26, 2006 at 10:00 am
When calling the function does explicit casting work?
eg Instead of t1.seatloc_seat + 1 try cast(cast(t1.seatloc_seat as int) + 1 as nvarchar(50))
July 21, 2006 at 6:18 am
create trigger dbo.Assets_tiu
on dbo.Assets
after insert, update
as
set nocount on
-- Assuming table has PK of AssetID
update dbo.Assets
set LastUpdated = getdate()
where dbo.Assets.AssetID in (select I.AssetID from inserted I)
go
July 20, 2006 at 4:22 am
Sorry Ryan,
I did not really read the thread and had done something similar with a bitwise date format last week.
Your solution is very elegant.
July 11, 2006 at 7:00 am
Try using a function like:
create function dbo.SillyDate2SQLDate
(
@SillyDate varchar(15)
)
returns datetime
as
begin
declare @RetDate datetime
declare @Months table
(
MonthNbr char(2) collate database_default not null
,SearchMonth varchar(9) collate database_default not null primary key
 
July 11, 2006 at 6:16 am
How about something like...
-- insert trigger
insert into history
select *
from inserted
-- update trigger, assuming PK does not change.
insert into history
select I.*
from inserted I
join deleted D on I.PKCol = D.PKCol
where not (
I.Col1...
June 15, 2006 at 5:31 am
Try something set based like the following. The functions will need to be altered to take into account weekends, public holidays etc. Obviously this has not been tested.
create function dbo.PrevValidLeaveDate ( @LeaveDate...
June 13, 2006 at 5:52 am
Not quite sure what you are trying to do but this should produce the result you want:
select t1.fk_1, t1.fk_2, t1.[date]
from @tmpTable t1
where t1.[primary] = 'Y'
and t1.[date] = (select max(t2.[date])
from...
May 10, 2006 at 8:08 am
Viewing 15 posts - 1,471 through 1,485 (of 1,489 total)