Viewing 15 posts - 361 through 375 (of 5,356 total)
DATEDIFF is not the best option on a larger table as it will prevent the use of an index
See if this helps:
May 6, 2005 at 5:02 am
Am I right, that you don't know in advance how many dy_ columns there will be?
If so, and given you don't want to do this at the client, have a...
May 6, 2005 at 4:56 am
Does this help?
DECLARE @dt VARCHAR(30)
SET @dt='disc_residual_20050330.csv'
SELECT
CAST(LEFT(RIGHT(@dt,12),8) AS DATETIME)
------------------------------------------------------
2005-03-30 00:00:00.000
(1 row(s) affected)
May 6, 2005 at 4:39 am
Needlessly harsh words, Remi.
It will certainly be more helpful for anyone here if you post a better solution than just exercise rhetorical platitudes, don't you think?
May 6, 2005 at 2:15 am
Basically the same as Nick M's suggestion. But with ORDER BY's.
set nocount on
use northwind
select
t1.CustomerID
, t1.OrderDate
from
orders t1
where
t1.OrderDate in
(
select top 2 --with ties
t2.OrderDate
from
orders t2
where
t2.CustomerID = t1.CustomerID
order by
t2.OrderDate desc
)
order by
t1.CustomerID
,...
May 6, 2005 at 1:44 am
I would expect a Clustered Index Seek (in case that index is a clustered one). Respectively an Index Seek along with a bookmark lookup in case the index is a nonclustered...
May 6, 2005 at 1:11 am
More than one way to skin that cat here.
select * from yourtable t1
where t1.[date]=
(select max([date]) from yourtable t2
where t1.id=t2.id)
order by t1.id
select t2.id, t1.amount, t2.maxdate from yourtable t1...
May 6, 2005 at 12:48 am
Depending on who is putting up a blog here, I would certainly read it. So, my answer is Yes, implement blogs here. Even if it is just to stay on the...
May 6, 2005 at 12:22 am
Also, see if this provides additional information:
http://www.sql-server-performance.com/fk_datetime.asp
May 4, 2005 at 7:21 am
May 4, 2005 at 7:05 am
May 4, 2005 at 6:50 am
Remi, did you try
set dateformat ymd
select
convert(datetime, '00/08/12')
, convert(datetime, '99/08/12')
, convert(datetime, '50/08/12')
, convert(datetime, '49/08/12')
May 4, 2005 at 4:03 am
Please avoid posting the same question to multiple fora. Keep the thread here:
http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=9&messageid=179647
May 4, 2005 at 3:57 am
Why do you think SQL Server is using to "wrong" index?
Here are some interesting links:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;195565
http://www.microsoft.com/sql/techinfo/tips/development/queryopstats.asp
http://support.microsoft.com/default.aspx?scid=kb;EN-US;325024
I think some are for SQL Server 2000 but they should give a...
May 4, 2005 at 3:53 am
Viewing 15 posts - 361 through 375 (of 5,356 total)