Forum Replies Created

Viewing 15 posts - 2,116 through 2,130 (of 4,085 total)

  • RE: Computed column possibility

    EasyBoy (12/6/2016)


    Thanks for reply. But, how can i use that column into main SP?

    It's no different from any other column. You either reference it indirectly through the view or...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: effective use of subquery with a where condition

    CELKO (12/6/2016)


    I hope that “is_active” is not a bit flag; that would mean you are using assembly language programming in SQL and we do not do that.

    Not that means that...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Weird Resource Database Message in Error Log

    ingcruzmoreno (12/6/2016)


    Were you able to fix this problem? I just got the same error. :S

    He already said that he had fixed it, but didn't remember what he did. And...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: trying to get rid of clustered index scan

    It's extremely difficult to troubleshoot performance issues without an execution plan (preferably actual). Can you attach the plan as a .sqlplan file?

    In the meantime, you might want to try...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Query optimization

    CELKO (12/6/2016)


    Using proprietary dialect constructs like CROSS APPLY and TOP make optimization difficult

    Now you're just making up stuff to support your claims.

    and portability impossible.

    Who cares?!?! Most people here...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Script to replace ","

    adonetok (12/6/2016)


    I tried the way from SSChasing Mays but got an error once I changed table name from "orders" to my table's name.

    Where is "near '-'" from script?

    (352866 row(s) affected)

    Msg...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Computed column possibility

    Here is the text.

    create procedure sp_dailyreq

    .....

    SELECT u.id,

    u.NAME,

    ...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: insert/copy deleted rows from within while loop

    Just include the @id and id values in your debug table.

    INSERT INTO @DebugTable(

    input_id,

    id,

    Result_On,

    AlarmId,

    [Target],

    Result)

    SELECT

    @id,

    id,

    @AlarmStart,

    @AlarmEnd,

    Result_On

    FROM @Results

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Pages Read & Written by a single query

    Adi Cohn-120898 (12/6/2016)


    You can use the profiler to show that. Another option is to use the extended events. You can see the amount of pages that the query...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Select query inside procedure taking long time, clustered indexes doing scans, need suggestion

    @sean-2, The splitter definition is in the query plan file.

    CREATE FUNCTION [dbo].[fn_SplitString]

    (

    -- Add the parameters for the function here

    @List NVARCHAR(MAX),

    @Delimiter NVARCHAR(255)

    )

    RETURNS...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Unexpected Behavior With TOP clause in a DELETE

    Recurs1on (12/5/2016)


    drew.allen (12/5/2016)


    I also notice that your deleting from tableA, but filtering TableB, so you're going to keep getting the same 10000 rows from TableB every time through the loop.

    Have...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: AlwaysOn Availability Group Query database count

    It sounds like the is_primary_replica condition should be part of the JOIN criteria instead of in the WHERE clause.

    select ag.Name, ag.Group_Id, agl.dns_name as 'ListenerName', COUNT(db.database_id) 'DatabaseCount'

    from master.sys.availability_groups ag

    inner...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Unexpected Behavior With TOP clause in a DELETE

    I also notice that your deleting from tableA, but filtering TableB, so you're going to keep getting the same 10000 rows from TableB every time through the loop.

    Have you tried...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Get only the top 1 from each subset of data`

    TheSQLGuru (12/5/2016)


    That looks workable. There is a solution with CROSS APPLY too. Look up Itzik Ben-Gan TOP rows per group.

    This probably doesn't meet the conditions for top rows per group....

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: compare two columns

    Assuming that column1 cannot be null, then this will give the same results and should be slightly faster.

    CASE

    WHEN column2 > column1

    THEN column2

    ELSE column1 END AS Result

    You have three...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 15 posts - 2,116 through 2,130 (of 4,085 total)