Forum Replies Created

Viewing 15 posts - 1,051 through 1,065 (of 3,348 total)

  • RE: RECREATE AN ID OF A ROW AFTER BEING DELETED

    abdellahmoh2016 (1/22/2016)


    Hi Thank you for your reply

    It's because my boss suggested me simple like that

    Tell your boss to stick to defining functionality, and leave the implementation to those who are...

  • RE: Trigger Change

    After taking a quick look, I can tell you that you are right.

    The UPDATE FROM used in the trigger will affect all rows that match an inserted/updated row on the...

  • RE: Today's Random Word!

    crookj (1/22/2016)


    Ed Wagner (1/22/2016)


    Revenant (1/22/2016)


    djj (1/22/2016)


    J Livingston SQL (1/22/2016)


    Peace

    World

    Earth

    Saturn

    Rings

    Doom

  • RE: Can't ALTER COLUMN to NOT NULL and ADD PRIMARY KEY in the same SQL Batch?

    The behaviour is as expected.

    SQL Server will always first compile an entire batch, then execute it. During compilation, various things are checked against the schema. But modifications made by early...

  • RE: How to figure out whether data is selected from dirty pages?

    SQL Guy 1 (1/22/2016)


    Hugo Kornelis (1/21/2016)


    But a way more important question is what you/they are trying to achieve. If the report is such that some margin of error in...

  • RE: How to pass parameter values to SQL query

    boettger.andreas (1/22/2016)


    SELECT TransDate / 100, SUM(Quantity)

    FROM IciVal

    GROUP BY TransDate;

    You may still need a WHERE clause to restrict it to the correct year.

    Does this devide TransDate by 100? Not sure why?

    From...

  • RE: Error handling in while loop...skip if failure

    I quickly scanned the posted code. The problem is that the layout is like this:

    WHILE (condition)

    BEGIN;

    BEGIN TRY

    -- Do something that might fail

    -- Find next row to process

    END TRY

    BEGIN CATCH

    -- Handle...

  • RE: converting the nvarchar value 'MSalreadyhavegeneration' ?

    Your problem stems from the fact that the SQL Server Query Optimizer can rearrange conditions as it sees fit. With the equality constraint it apparently picks an execution plan where...

  • RE: Looping Update Statement

    Here's a quick attempt:

    PS: For a tested solution, please post CREATE TABLE statements, plus INSERT statements with sample data, plus expected results.

    WITH HelperCTE AS

    (SELECT *, SUM(CASE WHEN Identifier = 'SET'...

  • RE: How to pass parameter values to SQL query

    MadAdmin (1/22/2016)


    Just throwing in my 2 pence

    Instead of the non sargable

    WHERE LEFT(TRANSDATE,6) = @CutOffDate

    use the sargable

    SELECT SUM(QUANTITY) AS TotalQty, @CutOffDate

    FROM ICIVAL

    WHERE TRANSDATE like @CutOffDate+'%'

    Since TransDate...

  • RE: How to pass parameter values to SQL query

    boettger.andreas (1/22/2016)


    Hi, I'm doing inventory snapshots for each of the last 12 months.

    For this I need to sum up all transactions up to the month I'm looking at.

    The function would...

  • RE: Color code column values

    In the report designer, select the cell you want to color code. Go to the properties, find the color (either foreground or background, whichever one you want), and replace the...

  • RE: converting rows to columns

    Please post CREATE TABLE statement for the table and INSERT statements with your sample data, plus expected results for that sample data.

    Also, why exactly do you need this? This kind...

  • RE: sql server query

    Since this appears to be a homework assignment, I am not going to spoon-feed you the answer.

    But I will help of course. Your query contains an aggregation (the AVG function)...

  • RE: How to pass parameter values to SQL query

    If the date column is indexed, then you will probably get better performance if you select the month as "WHERE Date >= 20160100 AND Date < 20160201"

    Also, instead of having...

Viewing 15 posts - 1,051 through 1,065 (of 3,348 total)