Forum Replies Created

Viewing 15 posts - 211 through 225 (of 1,468 total)

  • Reply To: group records by week

    I suspect that part of the problem is identifying what the value in t_stamp means.

    From  your query, it appears that you are assuming it to be the number of seconds...

  • Reply To: UNION ALL with CTE

    I would look at writing the query in a manner similar to this

    WITH cteBase AS (
    SELECT TOP ( 9223372036854775807 ) /* Force SQL to...
  • Reply To: UNION ALL with CTE

    As a side note - Why are you using a LEFT JOIN and a WHERE?

    In both queries you use

    LEFT OUTER JOIN [Repit].[LEVYDTA].[WHSWHSM] ws
    ON t.[RCWHS#] =...
  • Reply To: Cursor or best way to copy/update a table from another table

    Sorry about deleting your question.  I clicked the wrong button.

    To get the old value, use DELETED.YourFieldname

    To get the new value, use INSERTED.YourFieldName

    So, I would alter the description of the UPDATE...

  • Reply To: Cursor or best way to copy/update a table from another table

    Since I dont have actual tables and data, the code is untested.

    That said, I believe that the following code will do the UPSERT and AUDIT without the need for a...

  • Reply To: How to delete records selected from another table in stored procedure

    You will have to do 2 separate deletes.  And then I would also look at adding error handling and transaction control.

    Also, depending on the size of the data, you may...

  • Reply To: when execute query it take 32 second to return 2 rows so how to solve slowly iss

    I would try replacing the existing index with one of the following indexes.

    Test the performance of each one

    CREATE NONCLUSTERED INDEX IDX_ZPLID
    ON ExtractReports.dbo.TPls ( ZPLID, ZfeatureKey,...
  • Reply To: when execute query it take 32 second to return 2 rows so how to solve slowly iss

    Another possible issue is a cross-DB table creation and insert

    INTO ExtractReports.dbo.TPls

    Is the query running in the ExtractReports DB?

  • Viewing 15 posts - 211 through 225 (of 1,468 total)