Forum Replies Created

Viewing 15 posts - 1,351 through 1,365 (of 10,144 total)

  • RE: Please throw some light on how this complicated query works

    Often simply formatting a query nicely is sufficient to be able to figure out what's going on. The Simple Talk prettifier will get you most of the way there. I've...

  • RE: Select Statement SubQuery in the From Clause

    SELECT mu.Id, mu.name, mu.Code,

    Count(mu.Id) AS UnitCount

    Into TN -- temporary table?

    FROM Ref.MilitaryUnit mu

    LEFT JOIN Person.DMDC dmdc ON mu.Id = dmdc.Id

    LEFT JOIN Person.Military mp ON mu.Id = mp.UnitId

    Group By mu.Id,...

  • RE: How do we avoid junk in the VARCHAR fields ?

    Luis Cazares (8/1/2016)


    Maybe like this? Why do you have different validations for names and other values?

    UPDATE [MEMBER].[IMP_MEMBER_INT]

    SET

    [ContactLastName] = CASE WHEN...

  • RE: Are the posted questions getting worse?

    Sean Lange (7/29/2016)


    ChrisM@Work (7/29/2016)


    Sean Lange (7/29/2016)


    ChrisM@Work (7/29/2016)


    Sean Lange (7/29/2016)


    Good grief...the spammers are out in force today.

    Reported as spam

    Sweet!!! Maybe I can get banned!?!?!?!?!

    It's Friday, you can get anything you like...

  • RE: Are the posted questions getting worse?

    Sean Lange (7/29/2016)


    ChrisM@Work (7/29/2016)


    Sean Lange (7/29/2016)


    Good grief...the spammers are out in force today.

    Reported as spam

    Sweet!!! Maybe I can get banned!?!?!?!?!

    It's Friday, you can get anything you like 🙂

  • RE: Are the posted questions getting worse?

    Sean Lange (7/29/2016)


    Good grief...the spammers are out in force today.

    Reported as spam

  • RE: UPDATE SQL not working

    BigB (7/28/2016)


    Hi

    Yeah I know how outer join works. Just wondering why it is not updating tab1.id when select returning the result set. Anyway, how can this be achieved then?

    The select...

  • RE: UPDATE SQL not working

    The answer to your question is "there are no qualifying rows in t1 to update". You're mistaking NULL as a placeholder for NULL as a value.

  • RE: UPDATE SQL not working

    bhushanbagul (7/28/2016)


    tab1 contains only one column which is null in all records and tab2 also contains one column which is not null and having data. I want to update tab1.id...

  • RE: Are the posted questions getting worse?

    BrainDonor (7/28/2016)


    I would like to know why they even bother.

    How many people out there are going to think "I could do with a new kitchen, where should I look? I...

  • RE: How to write tsql for report

    JoNTSQLSrv (7/28/2016)


    Sergiy (7/28/2016)


    Can you be more specific about the term "completely different logic"?

    Are the tables at least the same for those different logics?

    Thanks for your reply Sergiy, i meant...

  • RE: Using variables with the LIKE operator

    Like this:

    SELECT ReturnValue

    FROM (

    SELECT

    ReturnValue = ISNULL(cast(replace(left(QueryValue,charindex('|',QueryValue)-1),'{','') as float)/1000,0),

    rn = ROW_NUMBER() OVER (PARTITION BY SourceID, PcsAssmntDataID ORDER BY IdentifierID DESC)

    FROM livefdb.dbo.PcsAssmntData_Queries

    WHERE SourceID = 'BRO'

    and QuerySetID = 1

    and QueryNumberID = 1

    and PcsAssmntDataID...

  • RE: Using variables with the LIKE operator

    NineIron (7/27/2016)


    Thanx but, in the meantime I came up with this solution..............................

    alter function dbo.fnWeight(@VisitID varchar(100))

    RETURNS float as

    BEGIN

    DECLARE @Return float

    set @VisitID=@VisitID + '{A^VS.WEIGHT}'

    select @Return=cast(replace(left(PADQ.QueryValue,charindex('|',PADQ.QueryValue)-1),'{','') as float)/1000

    from livefdb.dbo.PcsAssmntData_Queries PADQ

    inner join (selectSourceID,

    PcsAssmntDataID,

    max(IdentifierID) as...

  • RE: Using variables with the LIKE operator

    You don't need the wildcard on the left-hand side of the variable because you're matching from the left. It's also not SARGable (cannot exploit seeks). Try this instead:

    where PcsAssmntDataID LIKE...

  • RE: sql query

    sanjayasamantaray (7/27/2016)


    I have week codes like 201551 , 201552

    I want the sql query to return firstday and last day for those weeks

    How are the weeks defined?

    Is the first day...

Viewing 15 posts - 1,351 through 1,365 (of 10,144 total)