Forum Replies Created

Viewing 15 posts - 1 through 15 (of 17 total)

  • RE: user functions

    Where is the Stored Procedure? Lol

  • RE: user functions

    Lol, I was half way there, Write a Stored Procedure utilizing a "function".

    CREATE FUNCTION ODD_or_Even

    (@Digit nvarchar(3))

    RETURNS varchar(4)

    AS BEGIN declare @Return varchar(30)

    select @return = CASE WHEN

    CAST(@Digit as decimal)/CAST(2...

  • RE: user functions

    CREATE FUNCTION ODD_or_Even

    (@Digit nvarchar(3))

    RETURNS varchar(4)

    AS BEGIN declare @Return varchar(30)

    select @return = CASE WHEN

    CAST(@Digit as decimal)/CAST(2 AS decimal)NOT LIKE '%.0%' THEN 'Odd' ELSE 'Even' END

    return

    @return

    end...

  • RE: Not getting the email notification that I set up

    If it's a new server you migrated to, sometimes that server needs to be added to exchange.

  • RE: Displaying column names

    Are the column names constant or dynamic?

  • RE: SSIS source file with time in the name

    You could rename every file in the folder to "name_date". The "good" ones would stay the same and the "bad" would be modified like the others.

  • RE: SSIS source file with time in the name

    You can also rename the file to your liking and then import.

  • RE: Searching for n-categories

    Similar -

    WITH CTE AS (

    SELECT Project

    FROM Project_Category

    WHERE Category = '3')

    SELECT c.Project

    FROM CTE c JOIN Project_Category p ON p.Project = c.Project AND p.Category = '6'

  • RE: How to improve a aquery

    I believe you can get rid of the table variables altogether. Add the inner join used to populate the second table variable to the beginning of the first query to...

  • RE: listing of months for a particular year

    A Sraight PIVOT could work too!

    CREATe TABLE One(PoNum varchar(7),

    Date varchar (15))

    INSERT INTo One (PoNum, Date)

    VALUES('P001', '2013-01-01'),

    ('P002', '2013-02-01' ),

    ('P003', '2013-02-10'),

    ('P004', '2013-03-01')

    CREATe TABLE Two(PoNum varchar(7),

    IteMRef varchar (15),

    Qty int)

    INSERT INTo Two (PoNum,...

  • RE: How to query same table with 2 WHERE clause onto 1 row

    SELECT

    a.mins, a.stamp, b.mins, b.stamp

    FROM

    (SELECT min(value) as mins, min(t_stamp) as stamp

    from @t

    WHERE value = (SELECT min(value) FROM @t)) a,

    (SELECT min(value) as mins, min(t_stamp) as stamp

    from @t...

  • RE: Query

    SELECT REPLACE('2b',SUBSTRING('2b',PATINDEX('%[^0-9]%','2b'),1), '')

  • RE: Shift Column values to the left

    Lol, CASE -

    SELECT

    AlternateName = CASE WHEN AlternateName = ' ' AND AlternateName1 <> ' '

    THEN AlternateName1 WHEN AlternateName = ' ' AND AlternateName2...

  • RE: How do I remove the Nulls in my output?

    PIVOT -

    SELECT [1870], [1880]

    FROM

    (select yr_died

    from @1870_1880_DAT ) AS SourceTable

    --GROUP BY EJTranID, BranchID

    PIVOT

    (

    Count(yr_died)

    FOR yr_died IN ( [1870], [1880])

    ) AS PivotTable;

  • RE: DELETE Duplicates

    To Delete-

    WITH CTE AS (SELECT keys, month, MIN(Usage) AS Usage

    FROM #deletion

    GROUP BY keys, month)

    DELETE d

    FROM #deletion d

    ...

Viewing 15 posts - 1 through 15 (of 17 total)