Viewing 15 posts - 886 through 900 (of 5,356 total)
Sorry, I couldn't be of any help to you here.
May I add, that master.dbo.spt_values is an SQL Server internal helper table, which isn't...
February 24, 2005 at 4:51 am
Damn, I'm out of my head today
SELECT
REPLACE(STR(FLOOR(datediff( ss, GETDATE(),'20050224 13:12:00')/60),2), ' ','0') +
':' +
REPLACE(STR(datediff( ss, GETDATE(),'20050224 13:12:00')%60, 2),' ','0') TimeElapsed
makes it...
February 24, 2005 at 4:46 am
Something like this?
SELECT
STR(FLOOR(datediff( ss, getdate(),'20050224 13:12:00')/60),2) +
':' +
REPLACE(STR(datediff( ss, getdate(),'20050224 13:12:00')%60, 2),' ','') TimeElapsed
TimeElapsed
----------------------
46:59
(1 row(s) affected)
February 24, 2005 at 4:36 am
Okay, I now see what you mean. Keep thinking about it.
February 24, 2005 at 2:55 am
Oops, my mistake. The time span in my example is 7! days. So:
USE NORTHWIND
SELECT
CustomerID
, COUNT(*) No_of_Orders
, DATEDIFF(d,MIN(OrderDate), MAX(OrderDate))+1 TimeSpan
, COUNT(*)*1.0 / (DATEDIFF(d,MIN(OrderDate), MAX(OrderDate))+1) DailyOrder
FROM
Orders
WHERE CustomerID = 'ERNSH'
AND (OrderDate...
February 24, 2005 at 2:35 am
Another btw, did you tell your boss, that an auxiliary date table comes in handy in many situations? Curious on his reasoning here.
February 24, 2005 at 2:33 am
Here's a shot in the dark:
USE NORTHWIND
SELECT
CustomerID
, COUNT(*) No_of_Orders
, DATEDIFF(d,MIN(OrderDate), MAX(OrderDate)) TimeSpan
, COUNT(*)*1.0 / DATEDIFF(d,MIN(OrderDate), MAX(OrderDate)) DailyOrder
FROM
Orders
WHERE CustomerID = 'ERNSH'
AND (OrderDate >='19960717' AND OrderDate <='19960723')
GROUP BY CustomerID
Btw, since...
February 24, 2005 at 2:30 am
Why can't you create another table? Is this an assigned homework to you?
It should be an easy task with an auxiliary date table....
February 24, 2005 at 2:20 am
See if this provides additional information:
http://www.microsoft.com/technet/prodtechnol/sql/2000/maintain/ss2kidbp.mspx
February 24, 2005 at 1:47 am
You might want to read thoroughfully through the article PW referenced. It should give you some ideas.
February 24, 2005 at 1:43 am
Just for the records. You can also use the INFORMATION_SCHEMA views to get this information:
SELECT
ROUTINE_CATALOG
, ROUTINE_NAME
FROM
INFORMATION_SCHEMA.ROUTINES
WHERE
OBJECTPROPERTY(OBJECT_ID(ROUTINE_NAME), 'IsMSShipped')=0
AND
ROUTINE_DEFINITION LIKE '%CREATE VIEW%'
Same limitations as direct querying the system...
February 24, 2005 at 1:38 am
SP's are nothing mysterious. First place to look for stored procedures is BOL (aka the online help). Ken Henderson has a book "The Guru's Guide to Stored procedures...." I haven't...
February 24, 2005 at 1:23 am
I think I've mentioned, if the OP might utilize this. Hm, what about calling it a workaround? Or a start? Or...
February 23, 2005 at 8:23 am
Viewing 15 posts - 886 through 900 (of 5,356 total)