Forum Replies Created

Viewing 15 posts - 1,606 through 1,620 (of 6,036 total)

  • RE: Using Parameters in a Query is Killing Performance

    Make the PK on UserID non-clustered and create a clustered index on UpdateDt.

  • RE: Stored procedure terminated

    Same object has 2 or more permissions granted to it under the specified role.

    Which is pretty typical.

    For example, tables usually have permissions to INSERT, DELETE and SELECT for the same...

  • RE: Conditional Drop Table

    It's not about the tables, it's about the columns.

    When parsing a query SQL Server does not check if the table exists or not, but it validates the schema for all...

  • RE: Missing Stats like Missing Indexes

    As Gail said, SQL server creates missing statistics automatically.

    Check sysindexes to see which "missing" statistics have been created by the server in the background. Their names start with "_WA_Sys_"

  • RE: Reports taking too much time from application

    When you run those queries from SSMS their resultsets must be cached already, so the queries aren't actually executed.

    Try to run them at the end of the day, when SQL...

  • RE: Identity field for batch migrating data

    When you decide on table design don't be driven away by technical details.

    Follow the business logic.

    Should you distinguish different types of notes?

    Forget about the implementation in the old system.

    Is the...

  • RE: Question on parameters and minusing numbers

    ScottPletcher (2/16/2016)


    Get rid of the dashes (-) in the date, they introduce errors (ambiguity).

    Use format 'YYYYMMDD [hh:mm:ss]', which is always interpreted correctly, regardless of language/date settings.

    +1.

    But better - go with...

  • RE: purging old data and outer joins

    Try this one:

    SELECT X.ADDRESS_ID

    INTO #ToDelete

    FROM dbo.ADDRESS A

    WHERE NOT EXISTS (SELECT * FROM LEGAL_ENTITY L

    WHERE L.ADDRESS_ID = A.ADDRESS_ID

    )

    IF EXISTS (SELECT * FROM #ToDelete )

    DELETE A

    FROM #ToDelete A

    INNER JOIN...

  • RE: purging old data and outer joins

    IndianRock,

    Is it possible to record unique ADDRESS_ID's from deleted records of, say, table SERVICE_REQUEST when you clean it up?

    Best way would be to use FOR DELETE triggers on the tables...

  • RE: Partial insert regardless of constraint errors

    insert into Target (CodelistId, Value)

    select S.CodelistId, S.Value

    from Source S

    WHERE EXISTS (select * from Codelist L

    where L.ID = S.CodelistId

    OR

    insert into Target (CodelistId, Value)

    select L.ID , S.Value

    from Source S

    INNER JOIN Codelist...

  • RE: Trigger not Update another table

    luissantos (2/12/2016)


    Just a curiousity about your script, if i uncomment :

    --check if any records from inserted match SL

    SELECT *

    FROM SL sl

    RIGHT JOIN inserted i ON i.fistamp = sl.fistamp AND...

  • RE: Question on parameters and minusing numbers

    From the data given your script gives this outcome:

    (No column name)(No column name)

    @START_DATE2014-01-01 00:00:00.000

    @END_DATE2016-03-01 00:00:00.000

    @Previous_Start_Date2013-01-01 00:00:00.000

    @PREVIOUS_END_DATE2015-03-01 00:00:00.000

    What does not look right for you here?

  • RE: purging old data and outer joins

    Jeff Moden (2/15/2016)


    Sergiy (2/14/2016)


    Jeff Moden (2/14/2016)


    Sergiy (2/14/2016)


    I wonder - how long the SELECT part of the query would take?

    The DELETE part would probably take as long as not doing any...

  • RE: purging old data and outer joins

    Jeff Moden (2/14/2016)


    Sergiy (2/14/2016)


    I wonder - how long the SELECT part of the query would take?

    The DELETE part would probably take as long as not doing any deletes and would...

  • RE: purging old data and outer joins

    Since ADDRESS_ID on dbo.ADDRESS is a clustered PK you better delete only those entries which make up a continuous range of unused addresses.

    Which means - ADDRESS_ID is less than...

Viewing 15 posts - 1,606 through 1,620 (of 6,036 total)