Forum Replies Created

Viewing 15 posts - 2,656 through 2,670 (of 7,609 total)

  • Reply To: How to know the sql server environment run time

    Isn't the physical machine name different?

    SELECT SERVERPROPERTY('ComputerNamePhysicalNetBIOS')

  • Reply To: Inserting Data

    Is the report not able to do a LEFT JOIN instead of an INNER JOIN?  That would be the standard way to do that, without having to create a dummy...

  • Reply To: Selecting data from two columns

    You might want to consider assigning an alias to the modified value, so that if it ever changes later the definition of it is only in 1 place:

                

    October 21, 2019 at 8:01 pm

    #3690734

  • Reply To: SQL Query with CTE or other...!

    Maybe this will give you what you want:

    --** Data set up ***************************************************************
    CREATE TABLE dbo.questions (
    question_id int PRIMARY KEY,
    question varchar(1000)...
  • Reply To: Is SSIS really that bad?

    SSIS is a good (enough) tool, for what it does.  It is actually very good at moving data around, to/from SQL Server and other platforms as well.

    SSIS also has another...

  • Reply To: NOOB question with Case statement

    case

    when columnA <> 0

    then columnB = 1

    else columnB

    end

    The main thing to understand about CASE is that every result from a CASE must be a single value.  The expression leading to...

  • Reply To: how to rollback transaction explicitly

    Certain errors by default won't fail the entire transaction/batch.  Before the transaction, use:

    SET XACT_ABORT ON

    to make SQL fail the entire transaction if an error like that occurs.

     

  • Reply To: Execution Plan vs Statistics I/0?

    I think we may have interpreted the q differently.  I took "statistics i/o" to mean the results from:

    SET STATISTICS IO ON;

    The logical i/o results are directly comparable, aren't they?

    I think maybe...

  • Reply To: Execution Plan vs Statistics I/0?

    Really it's best to use them in combination.

    High I/O numbers tell you to look for better ways to do related part(s) of a query.  The execution plan shows you what...

  • Reply To: Question on triggers

    Something along these lines:

    ALTER TRIGGER [dbo].[trig_UpdatePlacementCount]
    ON [dbo].[DebtorHistory]
    AFTER INSERT, UPDATE
    AS
    BEGIN
    SET NOCOUNT ON;

    UPDATE DI
    SET placement_count = dh.file_no_count
    FROM dbo.DebtorInfo DI
    INNER JOIN inserted i ON i.file_no = DI.file_no
    INNER JOIN (
    ...
  • Reply To: Is it possible to compare columns' content?

    You could do comparisons after the fact using the auditing data, but that would be big overhead.

    You don't need separate triggers for the original trigger to indicate which column(s) were...

  • Reply To: get around invalid date

    The problem with the all digits string is it can be mistaken for an integer.

    100% false.  Date literals are strings, or delimited in some other way to distinguish them from...

  • Reply To: Using SELECT LEFT and WHERE IN in the same SELECT Statement.

    This might give better performance, if the optimizer recognizes the chance:

    WHERE AKey LIKE '[ABCDEGJ]%' AND (AKey LIKE 'AAA%' OR AKey LIKE 'BBB%' OR AKey LIKE 'CCC%' OR...
  • Reply To: get around invalid date

    And if my suggestions are broken, are so bad, why do the recent DATE and DATETIME2(n) data types default to it?

    Default to what exactly?  We know they're not stored in...

  • Reply To: Index Theories on adding new columns (Not Nullable)

    I disagree; when at all possible, you want to make the clustered index unique yourself whenever possible.  Yes, SQL will always force it to be unique anyway, but that often...

Viewing 15 posts - 2,656 through 2,670 (of 7,609 total)