Viewing 15 posts - 616 through 630 (of 2,171 total)
SELECTs.StoreName,
s.StoreID,
h.StoreDate,
h.OpenTime,
h.ClosingTime,
h.Comments
fromschema.mytable2 as s
left JOINschema.mytable1 as h on h.[StoreID] = s.[StoreID]
AND h.[StoreDate] between GetDate() and DateAdd(dd, 7, h.StoreDate)
WHEREs.StoreName = 'store'
November 25, 2008 at 2:24 am
SELECT POWER(27.0E, 1.0E / 3.0E)
Beware of integer division.
November 25, 2008 at 2:20 am
3rd root of 27 is calculated as (the positive value)
SELECT POWER(27.0E, 1.0E / 3.0E)
November 25, 2008 at 2:19 am
harsha.bhagat1
SELECT ddatetime, col1, col2
FROM (select ddatetime, col1, col2, row_number() over (partition by ddatetime, col1, col2 order by ddatetime) as recid
from table1
) as d
where recid > 1
November 24, 2008 at 12:48 pm
Ajay... Yes it does work.
DELETE t1
FROM ...
November 24, 2008 at 12:46 pm
SELECTDATEADD(DAY, DATEDIFF(DAY, '19000101', GETDATE()) / 7 * 7, '19000101') AS followingMonday,
DATEADD(DAY, DATEDIFF(DAY, '19000101', GETDATE()) / 7 * 7, '19000102') AS followingTuesday,
DATEADD(DAY, DATEDIFF(DAY, '19000101', GETDATE()) / 7 * 7, '19000103') AS...
November 24, 2008 at 8:08 am
Jeff Moden (11/24/2008)
Your way is better because it does eliminate a couple calculations.
Only OP can say which is right. Better is a rather subjective term.. 🙂
SELECT DATEADD(wk,DATEDIFF(wk, '19000101', getdate()), '19000107')
November 24, 2008 at 7:03 am
Jeff's simplified.
SELECT DATEADD(wk,DATEDIFF(wk, 0, getdate()), 6)
However when run on a sunday, the code returns following sunday.
My suggestion returns same sunday if run on a sunday.
November 24, 2008 at 1:52 am
SELECTDATEADD(DAY, DATEDIFF(DAY, '19000101', GETDATE()) / 7 * 7, '18991231') AS previousSunday,
DATEADD(DAY, DATEDIFF(DAY, '19000101', GETDATE()) / 7 * 7, '19000107') AS followingSunday
November 22, 2008 at 3:07 am
DELETE f
FROM (SELECT ROW_NUMBER() OVER (PARTITION BY code, other ORDER by code) AS recID
FROM Table1
) AS f
WHERE recID > 1
WHILE @@ROWCOUNT > 0
DELETE top (10000) f
FROM (SELECT ROW_NUMBER() OVER (PARTITION...
November 22, 2008 at 3:01 am
Really well done!
Do you have the time to test the speed of these simplified inline functions too?
CREATE FUNCTION dbo.fnBinaryFloat2Float
(
@BinaryFloat BINARY(8)
)
RETURNS FLOAT
AS
BEGIN
RETURNSIGN(CAST(@BinaryFloat AS BIGINT))
* (1.0 + (CAST(@BinaryFloat AS BIGINT) & 0x000FFFFFFFFFFFFF)...
November 21, 2008 at 4:05 pm
Where did you make that change?
Post back and I will update the blog post.
November 20, 2008 at 12:14 am
Code is taken from my blog here
http://weblogs.sqlteam.com/peterl/archive/2008/10/10/Keep-track-of-all-your-jobs-schedules.aspx
November 19, 2008 at 6:00 am
Chirag, even if there is a clustered index on the table, it doen't mean that records are stored physically in same order.
I know Itzik Ben-Gan has demonstrated this lately.
The index...
November 13, 2008 at 7:14 am
Use SQL Profiler to see which kind of activities brings server to it's knees.
November 13, 2008 at 7:12 am
Viewing 15 posts - 616 through 630 (of 2,171 total)