Forum Replies Created

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

  • RE: Deadlock Help

    Hmm. Typically one of the main things to address deadlocking is adjusting indexes. And the first priority in tuning is general is always to get the best clustered...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: REDGATE Compare

    There are certain changes that could make recreating the table more efficient than just the ALTERs. Would need details of the specific change(s) to know for sure. It's...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Deadlock Help

    How many unique UnitIds are there? It looks as if the clustering key on the table should be ( UnitId, StartDate, Id ) [Id is optional, just to make...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: DataType Conversion

    Sergiy (11/10/2015)


    David Rich (11/9/2015)


    While going through execution plan i observed this warning

    Type conversion in expression (CONVERT_IMPLICIT(varchar(255),[e].[abc],0)) may affect "CardinalityEstimate" in query plan choice

    and this is getting converted to nvarchar(255)....

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: DataType Conversion

    David Rich (11/9/2015)


    While going through execution plan i observed this warning

    Type conversion in expression (CONVERT_IMPLICIT(varchar(255),[e].[abc],0)) may affect "CardinalityEstimate" in query plan choice

    and this is getting converted to nvarchar(255). Will...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: First day and last day of a week

    Yet another version, as an in-line table-valued function, for easy use within a query:

    CREATE FUNCTION dbo.fn_first_day_and_last_day_of_week

    (

    @year smallint,

    @week tinyint

    )

    RETURNS...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Need help finding one set of data within another set of data for update

    Good point about partial matches. Presumably you'd want to match on the longest match (?!):

    insert into #import (importcity, title)

    select 'new_city_for_testing', 'rancho'

    insert into #city (city)

    select 'rancho'

    update i

    set importcity...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: In vs Outer Join

    Yep. NULLs can invalidate NOT IN logic. Add a check to eliminate NULLs from the subquery:

    SELECT COUNT(1)

    FROM dbo.Token TD WITH ( NOLOCK )

    WHERE ...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Performance Tuning - Cursor Based Procedure

    This may give you some ideas. I used a placeholder of <your_tally_table> for the tally table. Replace that with your own tally table name, either a physical tally...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • 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...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • 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 :)...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • 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...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • 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).

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • 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 >...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • 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...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

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