Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)

  • RE: Last 6 Month Qty for each Row

    Your function could be easier like this:

    CREATE FUNCTION [dbo].[ufn_GetYYYYMMSixMonthsAgo_YYYYMM](

    @pYYYYMM INT)

    RETURNS int

    AS

    BEGIN

    declare @dt...

  • RE: Substitute NULL value on converted date field?

    Peso (4/17/2008)


    SELECTSalesOrderId,

    Type,

    ISNULL(CONVERT(VARCHAR, Date, 103), 'No Date Specified') AS ExpiryDate

    FROMdbo.Values

    INNER JOINSalesOrders ON SalesOrders.SalesOrder = dbo.Values.RecordNumber

    INNER JOINdbo.DataNameFields ON dbo.DataNameFields.DataField = dbo.Values.DataField

    WHEREdbo.Values.DataField = '43'

    AND dbo.SalesOrders.Type...

  • RE: Substitute NULL value on converted date field?

    OR you can use:

    ----------------

    SELECT

    CASE

    WHEN [DateField] IS NULL then 'No Date Specified'

    ELSE convert(varchar, Date, 103)AS ExpiryDate

    END AS DD

    FROM

    [AppsGo].[dbo].[Sales]

  • RE: Last 6 Month Qty for each Row

    Hi, this is my solution, performance problem can occurs but...

    create function uf_Period_Previous:

    CREATE FUNCTION [dbo].[uf_Period_Previous](

    @Period INT)

    RETURNS INT

    AS

    BEGIN

    DECLARE @Year INT

    DEClARE @Month TINYINT

    DEClARE @PrevPeriod INT

    SET @Year = @Period / 100

    SET @Month = @Period...

Viewing 4 posts - 1 through 4 (of 4 total)