How To.... Classify

May 30, 2008



How to categorize the SQL Server database size? Like very large databases (VLDBs) etc
SQL Server 2000.
Thank you,
Gish

View 4 Replies


ADVERTISEMENT

How To Classify Hours By Ranges Of Time

Mar 31, 2008

Hi, I have the following query that is not working correctly

Basically I have a fields called TimeLeave (datetime) and I want to classify every record according to that field

The multiplication by the field b.Zulu is just to convert to local time, once converted I want to classify the local time with those numbers, but for example nothing falls in the first category and I get a bunch of records with a wrong ID

Any idea what should bet the correct sql statement to classify the records??

Thanks in Advance


CASE

WHEN SUBSTRING(CONVERT(VARCHAR(30),DATEADD(hh, -1*b.Zulu, a.TimeLeave),13),13,5) BETWEEN '22:30' AND '05:59' THEN 1

WHEN SUBSTRING(CONVERT(VARCHAR(30),DATEADD(hh, -1*b.Zulu, a.TimeLeave),13),13,5) BETWEEN '06:00' AND '08:59' THEN 2

WHEN SUBSTRING(CONVERT(VARCHAR(30),DATEADD(hh, -1*b.Zulu, a.TimeLeave),13),13,5) BETWEEN '09:00' AND '11:59' THEN 3

WHEN SUBSTRING(CONVERT(VARCHAR(30),DATEADD(hh, -1*b.Zulu, a.TimeLeave),13),13,5) BETWEEN '12:00' AND '14:59' THEN 4

WHEN SUBSTRING(CONVERT(VARCHAR(30),DATEADD(hh, -1*b.Zulu, a.TimeLeave),13),13,5) BETWEEN '15:00' AND '16:59' THEN 5

WHEN SUBSTRING(CONVERT(VARCHAR(30),DATEADD(hh, -1*b.Zulu, a.TimeLeave),13),13,5) BETWEEN '17:00' AND '19:59' THEN 6

WHEN SUBSTRING(CONVERT(VARCHAR(30),DATEADD(hh, -1*b.Zulu, a.TimeLeave),13),13,5) BETWEEN '20:00' AND '22:29' THEN 7

END


View 3 Replies View Related

Classify Customer Order Method Preference Based On Their History?

Nov 5, 2013

I am trying to classify a customer's order method preference based on their history. My source table has every order, order method, date, etc.

The logic is:

If only one order method, that is their preference>1 order method, the majority is their preferenceif 50/50 split, the order method with the mose recent order is the preference

I then created a query to group by the customer, order method, and max(date):

[URL]

I am having trouble though, creating a query that applies the above logic and outputs this:[URL]

View 13 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved