Forum Replies Created

Viewing 15 posts - 4,666 through 4,680 (of 7,610 total)

  • RE: Having Clause results minus results from Left join query

    In SQL Server, you'd need brackets around the name "Add":

    Select l.[add], l.phne

    from e_lkup l

    where mins is null

    GROUP BY phne, [add]

    HAVING count(*) >1

    EXCEPT

    select l.[add], l.phne

    from s_status ss

    left outer...

  • RE: Rename a network file using xp_cmdshell

    I don't think so. I use that style all the time to rename files (yes, I should use Windows directly, but I'm used to working from within SQL :)...

  • RE: how to check SQL job

    Yeah, that drives you crazy until you figure it out, since SQL doesn't always clear out the job activity queue. You have to join to another control table to...

  • RE: Rename a network file using xp_cmdshell

    SET @CMD='ren "\\pashare\shared\dhsr data\Adolescent Health\IMG\PHI_Refresh\export_file_IMG.xlsx" "export_File_IMG_' +@date+'.xlsx"'

    (Assuming date is a char data type and thus doesn't need CAST to char).

  • RE: Deadlock Help

    Can you give us the DDL for dbo.Cache and/or the query plan for:

    UPDATEdbo.Cache

    SETAvailability = Availability - 1,

    LastUpdated = GETUTCDATE()

    WHEREUnitId = @UnitId

    ANDStartDate < DATEADD(DAY, @Duration, @StartDate)

    AND@StartDate < DATEADD(DAY, Duration, StartDate)

    ANDAvailability >...

  • RE: INT or BIGINT with leading Zeros

    To help the performance of your procs, you need to make sure no implicit conversions occur on table columns that are being compared against (WHERE column_name ...) or JOINed (INNER...

  • RE: Selecting text between set characters

    Just as an FYI, you can use a CROSS APPLY in these types of situations to assign meaningful alias names to intermediate values, which can sometimes make the SELECT logic...

  • RE: Alternative for len() function in where clause

    IF that's a highly selective condition -- i.e., there are not many rows where that column has between 4 and 10 bytes -- then you might gain performance by adding...

  • RE: index_id = 0

    I would certainly rebuild that table, if it's used a lot or you have some other cause of concern over it. As always for best performance, first determine and...

  • RE: Searching improvment

    To tune for performance, you first need to review missing index stats and index usage stats (and index operational stats, if you can). The main improvement is to determine...

  • RE: In Trigger - Building a dynamic table with inserted data

    What you're doing is very dangerous code inside a trigger, as it's likely to run quite a while.

    That said, you can only reference the "inserted" from within the trigger itself,...

  • RE: Anyone help me with this aggregation problem? Thanks

    Is this homework or similar? If so, we can only give you general guidelines, not fully completed SQL.

  • RE: Update statistics

    river1 (11/4/2015)


    Hi,

    I saw this job below which runs from 20 to 20 minutos on my production server.

    Is it normal to have a statistics update every 20 minutos?

    ...

    and ...

  • RE: scrub data in 5 minute intervals

    It's best to delete by the clustering key.

    Therefore, what is the table clustered on? If it's clustered on identity -- gack! -- but you have an index...

  • RE: Find All Items That Call a Stored Procedure

    For SQL jobs, you could do something like this:

    SELECT j.name, js.*

    FROM msdb.dbo.sysjobsteps js

    LEFT OUTER JOIN msdb.dbo.sysjobs j ON j.job_id = js.job_id

    WHERE js.command LIKE '%sp[_]MysteryProcedure%'

Viewing 15 posts - 4,666 through 4,680 (of 7,610 total)