Forum Replies Created

Viewing 15 posts - 46 through 60 (of 125 total)

  • RE: Need help to create function for dynamically update every year

    Ed Wagner (5/27/2015)


    Dohsan (5/27/2015)


    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,...

  • RE: Need help to create function for dynamically update every year

    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...

  • RE: Status Movement

    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...

  • RE: Populating data for every day of the week

    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...

  • RE: Understanding CAST(INT AS DATETIME)

    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...

  • RE: Dynamically delete the data based on date column

    Try using GETDATE() instead of @data in Imex's example, it should get you to where you want

  • RE: Help with code please. Parsing a string

    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?

  • RE: Help with code please. Parsing a string

    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...

  • RE: Help with code please. Parsing a string

    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...

  • RE: Help with code please. Parsing a string

    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...

  • RE: Help with code please. Parsing a string

    raza.qadri (5/18/2015)


    its a simple insert into statement

    insert 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...

  • RE: Help with code please. Parsing a string

    Would you be able to provide sample DDL of how you currently do the insert?

  • RE: Change in Query

    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...

  • RE: Finding the item filled in prior to this one

    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...

  • RE: group by part of string

    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)...

Viewing 15 posts - 46 through 60 (of 125 total)