Forum Replies Created

Viewing 15 posts - 4,006 through 4,020 (of 10,144 total)

  • RE: Help On Query

    drop table #Sample

    create table #Sample(Name Varchar(100),Role Varchar(10))

    insert into #Sample values ('Vignesh' , 'Admin')

    insert into #Sample values ('Vignesh' , 'User')

    insert into #Sample values ('Bala' , 'Admin')

    insert into #Sample values ('Bala' ,...

  • RE: concatenate with leading zeros

    dwain.c (9/9/2013)


    Jeff Moden (9/9/2013)


    PRINT '========== Another Integer Math Method =========='

    SET STATISTICS TIME ON;

    SELECT @BitBucket = RIGHT(1000000000 + C1*1000 + C2, 9)

    FROM #TestTable;

    SET STATISTICS TIME...

  • RE: Recalculate Wages (Reposted for SQL 2008 with additional columns)

    I'm sure we can work it out if you can knock up a suitable sample data set. The problem you are facing is that the data you have is already...

  • RE: Best way to do this kind of group by

    Mark-101232 (9/9/2013)


    Probably not the best way, but seems to work

    SELECT DISTINCT

    Grp_A, Grp_B, Grp_C,

    SUM(Val_A) OVER(PARTITION BY Grp_A,...

  • RE: A Hazard of Using the SQL Update Statement

    Jeff Moden (9/9/2013)


    ChrisM@Work (9/9/2013)


    Prior to the introduction of MERGE I'd have agreed with this - we learned to ensure that multiple source rows for a target row had the same...

  • RE: Recalculate Wages (Reposted for SQL 2008 with additional columns)

    Try this - but beware, some of your original data is incorrect:

    SELECT

    EmpID, EarningCode, PayPerPeriod, EQHourlyRate, HoursWorked, Amount, Dept,

    nRate = d.NewRate, nAmount = d.NewAmount,

    NewRate = CAST(ROUND(sw.NewAmount/HoursWorked,4) AS DECIMAL(10,4)),

    NewAmount = CAST(ROUND(ISNULL(sw.NewAmount,d.Amount),2,0)...

  • RE: Query error

    opc.three (9/9/2013)


    SELECT FORMAT(GETDATE(), 'MM/dd/yyyy HH:mm:ss')

    AS [try the FORMAT function available in SQL 2012 and above];

    Thanks Orlando, I'll have a play with this at home...

  • RE: A Hazard of Using the SQL Update Statement

    natalie.ignatieva (9/9/2013)


    Jeff Moden (9/8/2013)


    I, however, do not consider the fact that it won’t give you an error for an attempted multiple-update on a single row a fault. Nay. ...

  • RE: Strange query gives strange results

    odepriester (9/6/2013)


    GilaMonster (9/6/2013)


    The filter is on the join and it's an outer join. So the filter is done before the join then the left join joins in the matching rows,...

  • RE: Strange query gives strange results

    odepriester (9/6/2013)


    Thanks for answers but the fact is that I don't need this "o.type = 'abcd'" and if I had done this query by myself I would never have written...

  • RE: get value from a function in a Stored Procedure

    Are you sure you need a function? I think you need a little nudge in the right direction with APPLY:

    SELECT

    OFC.CompanyID,

    PRAD.ProjectID,

    PRAD.ProposalID,

    P.ProposalNo,

    P.ProposalName,

    PRAD.DateAdded,

    x.TSP,

    x.QSP,

    DiscountPercent = x.TSP + x.QSP

    FROM ProposalRequestApprovalDetails PRAD

    INNER JOIN ProcessProposalApprovalDetailsCLC PDC

    ON...

  • RE: Query help to show a column

    This link might help.

    In your first query, the left join to ActivitiesAdditionalFieldsValues AS TAFV is converted into an inner join when CboValues TCBOV is inner joined to it.

    Changing the...

  • RE: Strange query gives strange results

    It's a nice little setup for augmenting Gail's fine explanation with some tables. Is id_object the PK of the object table, by any chance?

  • RE: Recalculate Wages (Reposted for SQL 2008 with additional columns)

    nfpacct (9/5/2013)


    Chris,

    I added 2 new columns - NewAmount and NewRate (The newamount is based on the calculated newrate)

    The desired result is the existing Amount Column values to be replaced...

  • RE: Recalculate Wages (Reposted for SQL 2008 with additional columns)

    ChrisM@Work (9/5/2013)


    Almost clear enough to make a stab at it...could you post the expected result set, or, alternatively, add an extra column say 'NewAmount' to your sample data which contains...

Viewing 15 posts - 4,006 through 4,020 (of 10,144 total)