Forum Replies Created

Viewing 15 posts - 9,376 through 9,390 (of 10,144 total)

  • RE: Help writing function to get decimal from string

    Garadin (11/18/2008)


    Rogue Dead Guy Ale is actually my favorite beer... I almost said as much in the last post, but got busy and just submitted it. Two Hearted Ale...

  • RE: conditional if statements

    You're welcome. Does it work now? If so, it would be beneficial to post your completed query here - you never know when someone else is going to come up...

  • RE: Adding empty rows for items which do not exist

    Your colleagues version is exactly what I would have done pre tally-tables.

    Incidentally, this...

    Substring(Cast(l.LogDate as nvarchar), 1, 11) = t.logdate

    could be a performance killer, SQL Server won't know if a...

  • RE: conditional if statements

    Have you considered writing it like this...

    [font="Courier New"]UPDATE [AppUsers]

       SET [Username] = @NewUsername

    WHERE [Username] = @OldUsername

       AND @OldClassification = ''

       AND @OldMerchant = ''

    UPDATE [AppUsers]

      ...

  • RE: Adding empty rows for items which do not exist

    Hi Chris

    It's because there's a time component in LogDate. Using a range takes care of this:

    [font="Courier New"]SELECT DATEADD(DAY, n.number-1, @StartDate) AS CalcLogDate,

            COUNT(DISTINCT(ProcessID)) AS ProcessCount

    FROM Numbers n

    LEFT JOIN #LogEntry l...

  • RE: CTE returns NULL value.

    What happens when you run this simplified version of your query? If you supply some sample data then forum members will be able to test themselves.

    [font="Courier New"]

    DECLARE @HieID -- assign...

  • RE: How to convert bit to character

    DECLARE @bit BIT

    SET @bit = 0 -- or 1, or comment out

    SELECT @bit AS BitValue, CASE @bit WHEN 1 THEN 'Y' WHEN 0 THEN 'N' ELSE NULL END AS YesNo...

  • RE: CTE returns NULL value.

    sqluser (11/19/2008)


    i am getting the following error while executing the procedure.

    The statement terminated. The maximum recursion %d has been exhausted before statement completion.

    Please help to solve the problem.

    There is insufficient...

  • RE: Find Closest Match Data

    Token matching works quite well...

    [font="Courier New"]DROP TABLE #Table

    CREATE TABLE #Table (TheValues VARCHAR (20))

    INSERT INTO #Table (TheValues)

    SELECT '0010' UNION ALL        

    SELECT '11242' UNION ALL      

    SELECT '0011246' UNION ALL  

    SELECT '0011264' UNION ALL    

    SELECT...

  • RE: CTE returns NULL value.

    Can you post the procedure?

  • RE: Adding empty rows for items which do not exist

    Hi Chris

    Do you have a tally (numbers) table? If so, try this:

    [font="Courier New"]DECLARE @StartDate DATETIME, @EndDate DATETIME

    SET @StartDate = 'Nov 01 2008'

    SET @EndDate = 'Dec 01 2008'

    SELECT DATEADD(DAY, n.number-1, @StartDate)...

  • RE: use "sum" aggregate function as criteria

    Can you UPDATE tempTable? If so, you could use the running totals solution:

    http://www.sqlservercentral.com/articles/Advanced+Querying/61716/

    Cheers

    ChrisM

  • RE: Retrieving latest date from 2 fields in table

    Try this:

    ORDER BY CASE WHEN ISNULL(DateAmended, DateCreated) > DateCreated THEN DateAmended ELSE DateCreated END DESC

  • RE: Using MAX in a SELECT Statement

    Hi Michael

    I don't think this could be converted into a view in the exact way that you've suggested because the parameters are required for the derived table, i.e. before the...

  • RE: The flow of an UPDATE STATEMENT with a FROM CLAUSE

    Hi John

    Compare the SELECT component of each statement.

    Row count

    Values if you feel it is necessary

    Time.

    This is what I mean by the SELECT component:

    [font="Courier New"]SELECT [P].[LAST_PAYMENT_DATE]

       ,.[NEXT_PAYMENT_DATE]

       ,[P].[CUR_PAYMENT]

       ,.[AVG_PMT_FREQ]

    FROM [dbo].[Amortization]...

Viewing 15 posts - 9,376 through 9,390 (of 10,144 total)