Forum Replies Created

Viewing 15 posts - 151 through 165 (of 276 total)

  • RE: Are the posted questions getting worse?

    How about "crap answers only"?


    "If I had been drinking out of that toilet, I might have been killed." -Ace Ventura

  • RE: Are the posted questions getting worse?

    I would like to suggest that the title of this thread be changed to:

    Are the posted questions getting worser?


    "If I had been drinking out of that toilet, I might have been killed." -Ace Ventura

  • RE: Multiple row update query

    UPDATE GLAMF

    SET Activesw = 0

    WHERE ACCTID NOT IN

    (SELECT ACCTID from GLPOST)


    "If I had been drinking out of that toilet, I might have been killed." -Ace Ventura

  • RE: Returning multiple values from a single value

    IF object_id('tempdb..#TimeTicket') IS NOT NULL

    DROP TABLE #TimeTicket

    CREATE TABLE #TimeTicket

    (

    employeeIDINTNOT NULL,

    TotalHoursDECIMAL(4,2)NOT NULL

    )

    INSERT INTO #TimeTicket (employeeID, TotalHours)

    SELECT 100, 13 UNION ALL

    SELECT 200, 11 UNION ALL

    SELECT 300, 7 UNION ALL

    SELECT 400, 23.25 UNION...


    "If I had been drinking out of that toilet, I might have been killed." -Ace Ventura

  • RE: T-SQL to get value on any given day

    Even with the...

    AND CTE1.item = CTE2.item

    ...in the join?

    It seemed to work okay. Did I screw something up?


    "If I had been drinking out of that toilet, I might have been killed." -Ace Ventura

  • RE: T-SQL to get value on any given day

    If I'm understanding correctly, here's what I'd do in this situation:

    IF object_id('tempdb..#foo') IS NOT NULL

    DROP TABLE #foo;

    CREATE TABLE #foo (item CHAR(1), changedate DATETIME, value INT);

    INSERT #foo (item, changedate, value)

    VALUES ('x',...


    "If I had been drinking out of that toilet, I might have been killed." -Ace Ventura

  • RE: TSQL Script help for new user

    select

    MethodDate,

    Method

    from

    @TestData

    where

    Method = 'A'

    UNION ALL

    select top 1

    MethodDate,

    Method

    from

    ...


    "If I had been drinking out of that toilet, I might have been killed." -Ace Ventura

  • RE: Trying to SUM row with Current Date to Row with "Last Month" Date

    When someone solves your original question, there is a button you can click on that post to "mark as solution", that's all I meant.

    As for your next question, I...


    "If I had been drinking out of that toilet, I might have been killed." -Ace Ventura

  • RE: Trying to SUM row with Current Date to Row with "Last Month" Date

    Glad I could help. You can mark that post as the solution if you're all set. 🙂


    "If I had been drinking out of that toilet, I might have been killed." -Ace Ventura

  • RE: condition to identify values that are +/- than 2 cents

    I have no idea what FavUnfavCostChange is, but would it help to cast it as a specific data type?

    CASE

    WHEN CAST(SUM(FavUnfavCostChange) AS DECIMAL(10,2)) < 0.02 THEN...


    "If I had been drinking out of that toilet, I might have been killed." -Ace Ventura

  • RE: Trying to SUM row with Current Date to Row with "Last Month" Date

    I'm pretty sure that's what I thought you meant. Are you sure my code isn't working right? I am adding the current month's ACTIVITYDEBIT to the previous month's Last_Trail_Balance_Debit.


    "If I had been drinking out of that toilet, I might have been killed." -Ace Ventura

  • RE: How to get most recent and oldest from the the joins to a child table

    Here's another version that I guess might be a bit more efficient? Only uses 2 CTE's instead of 4.

    DECLARE @Employee TABLE (EmployeeID INT, EmployeeName VARCHAR (100), EmployeeDOB DATETIME)

    INSERT INTO @Employee...


    "If I had been drinking out of that toilet, I might have been killed." -Ace Ventura

  • RE: How to get most recent and oldest from the the joins to a child table

    P.S. If you have any situations where a record in @Employee won't also exist at least once in the two other tables, you will want to use LEFT OUTER JOIN...


    "If I had been drinking out of that toilet, I might have been killed." -Ace Ventura

  • RE: Multiple updates using a CTE

    How can the users run scripts to UPDATE tables if they can't even use table variables or temp tables?


    "If I had been drinking out of that toilet, I might have been killed." -Ace Ventura

  • RE: Trying to SUM row with Current Date to Row with "Last Month" Date

    I'm not sure if I'm understanding you, but does this do what you want?

    IF OBJECT_ID('TempDB..#MyTrialBalance','U') IS NOT NULL

    DROP TABLE #MyTrialBalance

    CREATE TABLE #MyTrialBalance (

    [Trial_Balance_ID] [int] IDENTITY(1,1) PRIMARY KEY CLUSTERED NOT NULL,

    [FISCALYEAR]...


    "If I had been drinking out of that toilet, I might have been killed." -Ace Ventura

Viewing 15 posts - 151 through 165 (of 276 total)