Forum Replies Created

Viewing 15 posts - 1,546 through 1,560 (of 6,036 total)

  • RE: Query Performance Issue with multiple unions and a view

    Every query has a common block:

    FROM dbo.RequestorToCapabilityDeferred_vw r

    INNER JOIN dbo.Capability_tbl c ON r.capabilityId = c.capabilityId

    LEFT OUTER JOIN dbo.CapabilityStatus_tbl CS on r.capabilityStatusid = CS.capabilityStatusid

    It should be made into...

  • RE: Books Online / Stupid Help Viewer

    Brandie Tarvin (3/22/2016)


    Anyone have any advice?

    Leave it.

    Forget about it.

    I found the new BOL absolutely useless.

    Google may not be perfect, but at least it gets you what you need...

  • RE: conditionally count method

    You must have a mapping table between varieties of flavors and "flavor groups" (or how do you name it).

    When you say "all chocolate flavors" you mean "chocolate", "chocolate swirl", etc....

  • RE: Index reorganization

    For non-clustered indexes you may create pairs if identical indexes and disable one of them.

    Then you run something like this:

    IF INDEXPROPERTY(OBJECT_ID('dbo.TableName'), 'IX_Index1_Odd', 'IsDisabled') = 0

    BEGIN

    ALTER INDEX IX_Index1_Even ON dbo.TableName...

  • RE: Query help

    David Hall-426383 (3/22/2016)


    I have an nvarchar column called rptnum in a table that I have created a .NET routine to insert a report number. This is built by getting the...

  • RE: Looping and scalar value

    Or - eliminate the variable @Result completely:

    declare @List varchar(max) = '123456789'

    declare @ChunkSize int = 3

    declare @SepChar char(1) = ','

    SELECT STUFF((

    SELECT @SepChar + SUBSTRING(@List, N, @ChunkSize)

    FROM dbo.Tally t

    where

    N >= 1...

  • RE: Looping and scalar value

    kuopaz (3/22/2016)


    Ended up with this, that is closer to my actual requirement. Previously used a WHILE loop and counter.

    declare @List varchar(max) = '123456789'

    declare @ChunkSize int = 3

    declare @SepChar char(1) =...

  • RE: Query performance help (ready-to-use sample data included)

    ColdCoffee (3/18/2016)


    Hello folks.. i have the following requirement (the table names are modified) :

    1. For every row in OrderDetails table with ActionCode not equal to 'V' , check the last...

  • RE: Optimizing Queries

    This should be incredibly faster:

    SELECT StatusName PNRStatus from dbo.Status S

    WHERE EXISTS (SELECT * FROM [Transactions] T WHERE T.[PNRStatus]=S.StatusName)

    ORDER BY PNRStatus

    SELECT [AgentID] from dbo.Agent A

    WHERE EXISTS (SELECT * FROM [Transactions]...

  • RE: Add Date Stamp to File created using 'INTO' Statement

    Luis Cazares (3/18/2016)


    You'd be better by creating a table with a date column to identify each "file"

    - and a clustered index with this column in the first position.

  • RE: Take out sub-query

    select

    datepart(yyyy, D.Date)as "Year",

    count(*)as "A",

    sum(DV.PageCount)as "B"

    FROM [DB].[dbo].[Test] D with (nolock)

    INNER join (

    SELECT TestumentID, TestumentVersionID, PageCount, ROW_NUMBER() OVER(PARTITION BY TestumentID ORDER BY [TestumentVersionID] DESC ) RN

    FROM [DB].[dbo].[TestVersion]

    ) DV with (nolock) on...

  • RE: Is it possible to alias a function within a SELECT statement?

    INNER JOIN dbo.fnMyFunction('2016-3-21') F ON F.ColumnName = OtherTable.ColumnName

    dbo.fnMyFunction must be a table function to be used in a JOIN.

  • RE: 0 is equal to zero length string. Can someone explain how this can be?

    Jeff Moden (3/18/2016)


    Heh... maybe I should call up one of the old standards, document it, and call it "JMOD" for short. 😀

    Plagiarist!!!

    :w00t:

    As for CHAR(0) - well, it's actually a character,...

  • RE: 0 is equal to zero length string. Can someone explain how this can be?

    ScottPletcher (3/17/2016)


    I don't see that. A middle name of '' should mean the person has no middle name (and that such fact is known); a middle name of NULL...

  • RE: Optimize SP

    TheSQLGuru (3/17/2016)


    1) using a temp table (NOT table variable!!)

    Not sure if there is much of a difference here.

    Scoping - yes, quite different.

    Can you name anything else?

Viewing 15 posts - 1,546 through 1,560 (of 6,036 total)