Forum Replies Created

Viewing 15 posts - 1,981 through 1,995 (of 2,458 total)

  • RE: query help

    KtmGuy (1/29/2014)


    Try executing this query ;

    UPDATE a

    SET

    a.Status = CASE WHEN b.action IN(1,3,4,5,6) THEN 'Y' ELSE 'N' END

    FROM

    TableA a

    JOIN

    TableB b

    ON

    a.SID = b.SID

    Well done! Just a quick...

  • RE: Need To display data in Blocks (Column name: value )

    There were some problems with your sample data which I cleaned up.

    USE tempdb

    GO

    IF OBJECT_ID('tempdb.dbo.Test_AA') IS NOT NULL DROP TABLE dbo.Test_AA

    IF OBJECT_ID('tempdb..#Test_AA_stg') IS NOT NULL DROP TABLE #Test_AA_stg

    GO

    CREATE TABLE [dbo].[Test_AA](

    ID int...

  • RE: How to use scalar function without WHILE

    ChrisM@home (1/27/2014)


    vip.blade (1/27/2014)


    Hi,

    thanks for your fast response! It's a function to calculate the Levenshtein-Distance from this article: http://www.sqlservercentral.com/articles/Fuzzy+Match/92822/

    As far as I know there is no way to transform it...

  • RE: How to use scalar function without WHILE

    Hi,

    thanks for your fast response! It's a function to calculate the Levenshtein-Distance from this article: http://www.sqlservercentral.com/articles/Fuzzy+Match/92822/ [/url]

    As far as I know there is no way to transform it into an...

  • RE: SELECT INTO for running total query

    Before you go any farther, if you've got lots of rows this is going to be pretty slow because of the triangular join you're doing. You probably should take...

  • RE: SSRS report and multiple datasets

    pietlinden (1/24/2014)


    Just wondering, but can you force the queries to run in a single transaction, so they all execute and then the report is rendered?

    If there are parameters (especially cascading...

  • RE: SSRS report and multiple datasets

    jignesh209 (1/24/2014)


    SSRS is not blocking,but is it a good practice to create 6 different Datasets and tying it up with 6 different stored procedures.

    There is nothing wrong with that at...

  • RE: Running Total

    patrickmcginnis59 10839 (1/21/2014)


    Awesome link here discussing various methods:

    http://stackoverflow.com/questions/11310877/calculate-running-total-running-balance

    This article provides different ways to do a running total but has some might not be the best advice based on my experience....

  • RE: Find the second or third record with 30 days

    This should do the trick:

    WITH visitInfo AS

    (

    SELECT *,

    RANK()

    OVER (PARTITION BY UnitNumber, YEAR(AdmitDateTime), MONTH(AdmitDateTime)

    ORDER BY AdmitDateTime) VisitSeqThisMonth

    FROM dbo.TEST

    )

    SELECTUnitNumber,

    AccountNumber,

    Diagnosis,

    AdmitDateTime,

    DischargeDateTime,

    ReadmitDate,

    DaysToReadmit,

    ReadmitAccountNumber

    FROM visitInfo

    WHERE VisitSeqThisMonth=1

    --ORDER BY UnitNumber, AdmitDateTime;

    Edit: Code cleanup,...

  • RE: Order of Tables in JOIN ??

    Luis Cazares (1/23/2014)


    That's because when SQL Server is "reading" the code, it won't find a reference to Table_B alias until it gets to Table_B.

    Beat me by 3 seconds!

  • RE: Order of Tables in JOIN ??

    homebrew01 (1/23/2014)


    I thought it didn't matter what order the JOIN statements are in a query, but if I join TABLE_B before Table_C, I get an error. If I join Table_B...

  • RE: How to extract a column value from data stored in XML column.

    arthurolcot (12/23/2013)


    You can extract specific nodes by use the xml values() method. Additionally, because the data that you have is using a namespace, you also in this instance need to...

  • RE: Query XML Value

    bryan 83518 (1/15/2014)


    Trying to work out how to query xml that looks like this I will loop through all the artist but only want the Main Artist not the Secondary

    <Artists>

    <ArtistText>Genie...

  • RE: Query XML Value

    Richard Fryar (1/15/2014)


    Rewritten to get the xml from a variable, but you should be able to apply this logic to your situation:

    declare @x xml

    select @x = '

    <Artists>

    <ArtistText>Genie Zhuo</ArtistText>

    <Artist Type="Main">

    <FullName>Genie Zhuo</FullName>

    </Artist>

    <Artist...

  • RE: passing a variable to CTE in a view

    ...but just came to know that our application/framework does not support procedures of functions

    Just a thought...

    This might not help with the hierarchy situation but may help you get around your...

Viewing 15 posts - 1,981 through 1,995 (of 2,458 total)