Forum Replies Created

Viewing 15 posts - 316 through 330 (of 355 total)

  • RE: Report Server - Calculate Execution Time

    Try this:

    DATEDIFF(minute, ExecutionLog.TimeStart, ExecutionLog.TimeEnd) AS TimeTaken

  • RE: Combing columns/filling in parameters

    I think it would be possible to do this in a single query by using XQuery on the XML in the col2 column to extract the parameter values and recursive...

  • RE: Date Function Best Alternative

    The expression can be simplified a little from

    LAST_UPDATE > DATEADD(day, -1, DATEADD(day, DATEDIFF(day, -1, GETDATE()), -1))

    AND

    Last_update < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)

    to

    LAST_UPDATE >= DATEADD(day, DATEDIFF(day, 1, GETDATE()), 0)

    AND

    Last_update...

  • RE: string manipulation help

    Sergiy,

    The task itself is stupid enough not to bother to run any benchmark tests.

    I have to admit getting a bit carried away with this string manipulation problem. The only...

  • RE: help with criteria

    Just a quick question. Is there a performance difference between using the

    WHERE NOT that you are using and

    where <> 'I' and <> 0

    Actually

    WHERE NOT (X.status = 'I' AND...

  • RE: string manipulation help

    Incidently, avoiding the use of the NULLIF function in these queries does give a significant performance improvement. The following compares Jeff's query with a functionally equivalent query that does not...

  • RE: string manipulation help

    Here are the 4 queries I used for the testing mentioned in my previous post. Unlike my original queries, they do return a row corresponding to every row in the...

  • RE: string manipulation help

    Who can say if I'm right other than the OP, it depends on the OP's precise requirements.

    OP does state the following which Jeff's query doesn't do.

    I also want to grouped...

  • RE: string manipulation help

    The following variation has a level of SELECT nesting that is one fewer, but gives the same results.

    SELECT LEFT(I.name, I.P2 - 1), RIGHT(I.name, LEN(I.name) - CHARINDEX('.', I.name, I.P2 + 1))...

  • RE: string manipulation help

    You haven't provided your table schema so I have used the following in my query below:

    CREATE TABLE Items (

    name varchar(100) NOT NULL

    )

    GO

    INSERT INTO Items

    SELECT 'IT'

    UNION ALL SELECT 'IT.Control.Bing'

    UNION...

  • RE: multiple rows in detail table, connected w AND in WHERE clause?

    Yep, my solution is essentially the same as Derek Dongray's, except that I use a derived table. Derek Dongray's solution is simpler and may be all you require, but mine...

  • RE: multiple rows in detail table, connected w AND in WHERE clause?

    If you need to retrieve those tblKandidaten records that have an associated tblK_Berufsziele record with Berufskuerzel = 'CIMP' AND another tblK_Berufsziele record with Berufskuerzel = 'INS', then the following should...

  • RE: help with criteria

    How about this.

    SELECT X.group, X.status, X.countOfTickets

    FROM (

    select a.group, a.status, countOfTickets = count(b.tickets)

    from group_tbl a

    left outer join tickets_tbl b

    ...

  • RE: Not able to Concatenate lastwaittype column in sysprocesses

    Just a reminder. If one of the column values is null, then "null + 'Test String'" will return null.

    Quite true, but that's not relevant here.

    The concatenation problem...

  • RE: Not able to Concatenate lastwaittype column in sysprocesses

    If you have a Tally table, run this

    SELECT P.lastwaittype, T.N, Code = ASCII(SUBSTRING(P.lastwaittype, T.N, 1))

    FROM master.dbo.sysprocesses P

    CROSS JOIN dbo.Tally T

    WHERE P.spid = 51

    My query results on a SQL Server...

Viewing 15 posts - 316 through 330 (of 355 total)