Viewing 15 posts - 46 through 60 (of 125 total)
Ed Wagner (5/27/2015)
Dohsan (5/27/2015)
May 27, 2015 at 6:06 am
This seems fairly similar to your previous question (Possibly even identical!), are you not able to use the method suggested by Chris? If you need further explanation, perhaps better to...
May 27, 2015 at 5:12 am
I'm not sure your expected out come matches fully with what you've provided in the history table. You seem to have a mix of statuses on 2014-06-30 and then a...
May 21, 2015 at 2:29 pm
Why would the rows in TableB not have the correct week number as per the date?
I've put together some DDL based on the example given
DECLARE @TableA TABLE
(
DayDT DATETIME NOT NULL,
WeekNum...
May 21, 2015 at 9:42 am
For the trivia, I'll also add you can CAST minus numbers to get a date previous to 1900
SELECTCAST(0 AS DATETIME);
SELECTCAST(-53690 AS DATETIME);
SELECTCAST(-53691 AS DATETIME);
Furthest you can go back is 1753-01-01...
May 21, 2015 at 2:46 am
Try using GETDATE() instead of @data in Imex's example, it should get you to where you want
May 20, 2015 at 2:23 am
How many conditional scenarios are there and do they apply to all alerts?
i.e. would @Rate > 0 apply Rate + Amount be the same for both alert 1 and 2?
May 18, 2015 at 6:52 am
So you take the body text from the alert_types table and body text can differ (different text, different variables) depending on the type of alert
How do you currently parse...
May 18, 2015 at 5:13 am
So the table has the generic alert text that you wish to update? Are there other types of alerts with different messages?
2 examples below, one to conditionally append the rate...
May 18, 2015 at 4:27 am
Does something like this work? Build the 'Body' string before the insert? Although if you have all the values, why not store them all? What happens when you wish to...
May 18, 2015 at 3:34 am
raza.qadri (5/18/2015)
its a simple insert into statementinsert into Alert_Types
values (1,'document_detail_view','Document ID: @document_id
Customer Name: @customer_name
Item name: @item_name
Quantity: @qty')
So you have the variables available (@document_id etc.), INSERT a generic string...
May 18, 2015 at 3:26 am
Would you be able to provide sample DDL of how you currently do the insert?
May 18, 2015 at 3:11 am
I'm guessing it's due to the underlying columns being of INT datatype
SELECTServerName = @@SERVERNAME,
TotalSpaceMB = SUM(CA1.total_bytes),
AvailableSpaceMB = SUM(CA1.available_bytes),
--Integer Maths will return 0
SUM(CA1.available_bytes) / SUM(CA1.total_bytes),
--Decimal
SUM(0E + CA1.available_bytes) / SUM(0E + CA1.total_bytes),
SUM(0E...
May 13, 2015 at 7:47 am
Think this may do the same without the extra join, assuming that the SUB_TYPEs always go up in value A -> B -> C etc
SELECTT1.TYPE,
T1.SEQ,
T1.SUB_TYPE,
ISNULL(NULLIF(T1.SUB_TYPE,''),CA1.Sub_Type)
FROM#TEMP AS T1
CROSSAPPLY (
SELECTC.TYPE,
SEQ = MIN(C.SEQ),
SUB_TYPE...
May 13, 2015 at 5:05 am
Building on the CASE statement version, use of cross apply to simplify
;WITH TestData (RandomString)
AS
(
SELECTA.RandomString
FROM(
VALUES('Chuff'),
('Chuff1'),
('Chufff'),
('Chuffty'),
('ff'),
('uff'),
('huff')
) AS A(RandomString)
)
SELECTCA1.GroupedThing,
Cnt = COUNT(*)
FROMTestData AS TD
CROSS
APPLY(SELECT CASE WHEN TD.RandomString LIKE 'Chu%' THEN 'Group1' ELSE 'Group2' END)...
January 14, 2015 at 8:14 am
Viewing 15 posts - 46 through 60 (of 125 total)