Forum Replies Created

Viewing 15 posts - 2,956 through 2,970 (of 8,753 total)

  • RE: Speeding Up Delete's on Large Databases

    Jeff Moden (10/31/2016)


    Eirikur Eiriksson (10/31/2016)


    Quick suggestion, reading the data to be deleted into a "bucket" variables can drastically speed up the delete, here is an example based on the DDL...

  • RE: Speeding Up Delete's on Large Databases

    Quick suggestion, reading the data to be deleted into a "bucket" variables can drastically speed up the delete, here is an example based on the DDL previously posted.

    😎

    DECLARE @id ...

  • RE: SSIS Excel import error

    Quick question, does the "user" have access to the share on the file server?

    😎

  • RE: Group by date fields

    DesNorton (10/31/2016)


    Eirikur's solution groups by PaymentComfirmDate.

    In order to group by Year/Month, you will need to use something like this, which groups by the 1st of every month.

    -- ...

    MonthYear = DATEADD(mm,...

  • RE: Group by date fields

    Here is a quick example that should get you passed this hurdle

    😎

    USE TEEST;

    GO

    SET NOCOUNT ON;

    /* Sample data set */

    ;WITH SAMPLE_DATA(Amount,PaymentComfirmDate,PaymentType) AS

    (

    SELECT

    ...

  • RE: Ports to be open for logshipping for ALWAYSON to stand-alone

    Have a look at this article "AlwaysOn Availability Groups, Listener, Named Instances, Port Numbers, etc.[/url]" from the SQL Server Customer Advisory Team.

    😎

  • RE: Completing Fixed Sets With Another Table

    Not a complete solution but should help you get over this hurdle

    😎

    USE TEEST;

    GO

    SET NOCOUNT ON;

    IF OBJECT_ID(N'tempdb..#Payment') IS NOT NULL DROP TABLE #Payment;

    CREATE TABLE #Payment (

    PaymentId int,

    PersonId int,

    PaymentYear int,...

  • RE: creating a sequence of number starting or each group of ID

    Quick suggestion, do the union in a CTE and apply the row_number outside the CTE

    😎

  • RE: WHAT TO DO WHEN DBCC CHECKDB(REPAIR_ALLOW_DATA_LOSS) FAILS

    Looks FUBAR, questions, how big is the database? what is the latest good backup? what other recovery options are there (manual data entry etc.)? do you have the failed hard...

  • RE: Stop query if it is taking too long

    Jeff Moden (10/24/2016)


    Eirikur Eiriksson (10/24/2016)


    you will need this index on the dbo.Transaction

    CREATE UNIQUE NONCLUSTERED INDEX [INDEX_NAME] ON [dbo].[Transaction]

    (

    [InvoiceUID] ASC,

    [IsSuccess] ASC,

    [TransKind] ASC,

    [TransactionDate] ASC

    )

    INCLUDE ( [CardNumber],[ReferenceNumber],[SeqCounter],[UnqReferenceNumber]);

    I came up with similar but...

  • RE: XML resultset using Query

    SqlStarter (10/29/2016)


    Thanks a lot Eirikur Eiriksson

    You are very welcome.

    😎

  • RE: XML resultset using Query

    This is quite easy when using FOR XML PATH, here is a quick example

    😎

    USE TEEST;

    GO

    SET NOCOUNT ON;

    IF OBJECT_ID(N'tempdb..#EmpMaster') IS NOT NULL DROP TABLE #EmpMaster;

    CREATE TABLE #EmpMaster (EMP_ID INT,Ename VARCHAR(50))

    IF OBJECT_ID(N'tempdb..#EmpDetail')...

  • RE: Stop query if it is taking too long

    mah_j (10/29/2016)


    you will need this index on the dbo.Transaction

    CREATE UNIQUE NONCLUSTERED INDEX [INDEX_NAME] ON [dbo].[Transaction]

    (

    [InvoiceUID] ASC,

    [IsSuccess] ASC,

    [TransKind] ASC,

    [TransactionDate] ASC

    )

    INCLUDE ( [CardNumber],[ReferenceNumber],[SeqCounter],[UnqReferenceNumber]);

    and this index for the dbo.Invoice

    CREATE UNIQUE NONCLUSTERED INDEX...

  • RE: Speeding Up Delete's on Large Databases

    Are there no indices on the table?

    😎

  • RE: Speeding Up Delete's on Large Databases

    Suth (10/28/2016)


    Hi,

    I'm currently trying delete data from a large database with the below code... But its taking quite a long time to delete 1000...

Viewing 15 posts - 2,956 through 2,970 (of 8,753 total)