Forum Replies Created

Viewing 15 posts - 106 through 120 (of 463 total)

  • RE: i need logic to get the days for most recent week that ends with Friday

    Not sure how you can include this in your query (if you can provide the test data and table create script, may be someone will help with the complete query)...

    ---------------------------------------------------------------------------------

  • RE: i need logic to get the days for most recent week that ends with Friday

    purushotham.k9 (12/22/2009)


    What is 'p' and 'Number' here in this code

    Thats a table in master database and it has numbers from 0 to 2047.

    That is a simulation of 'number' table. To...

    ---------------------------------------------------------------------------------

  • RE: i need logic to get the days for most recent week that ends with Friday

    Jeff Moden (12/22/2009)


    Sorry... I was still focused on your original post... that code was for only 1 week... this is for 2...

    SELECT DATEADD(dd,DATEDIFF(dd,6,GETDATE()+1)/7*7,-9)+t.Number

    FROM Master.dbo.spt_Values t

    WHERE t.Type =...

    ---------------------------------------------------------------------------------

  • RE: i need logic to get the days for most recent week that ends with Friday

    Jeff Moden (12/21/2009)


    Nabha (12/21/2009)


    All good answers above,

    one more way to find your last friday, (and then deduce your other days)

    Select dateadd(day, - (datepart(dw, getdate())+1), getdate())

    It doesn't appear to work...

    ---------------------------------------------------------------------------------

  • RE: i need logic to get the days for most recent week that ends with Friday

    Is there any other to remove the time part?

    Select dateadd(day, 0, datediff(day, 0, getdate()))

    ---------------------------------------------------------------------------------

  • RE: i need logic to get the days for most recent week that ends with Friday

    All good answers above,

    one more way to find your last friday, (and then deduce your other days)

    Select dateadd(day, - (datepart(dw, getdate())+1), getdate())

    ---------------------------------------------------------------------------------

  • RE: Create a new column with criteria

    Biz (12/20/2009)


    I have a table with data like:

    Group,Item,startdate,ID

    I need to add a serial number for item if there are more than one item in the group and the serial number...

    ---------------------------------------------------------------------------------

  • RE: INSERT INTO, using a SELECT and UNION ALL

    Sorry if I am underestimating your requirement, but 'UNION' will combine the result sets and all your 7 select query will act as one single select query. This combined result...

    ---------------------------------------------------------------------------------

  • RE: Browse for more in SSMS Connect to Server dialog does not display everything

    One of the reasons could be that the instance is hidden?

    Configuration manager -> SS2K5 Network config ->Protocols for <<instance>> -> properties -> Hide instance?

    ---------------------------------------------------------------------------------

  • RE: remove only Leading and trailing double-double-quotes

    Sorry if I've misunderstood ur requirement, but is this what you need?

    (this is what I could think of using STUFF, there could be better ways!)

    declare @des varchar(80)

    select @des =...

    ---------------------------------------------------------------------------------

  • RE: Convert of seconds to percentage value

    Sorry, this should also do (its implicit, my bad!)

    Declare @date datetime

    SET @date = dateadd(mi, 5,getdate())

    SELECT (DATEDIFF(SS, getdate(), @date)/86400.00) * 100

    ---------------------------------------------------------------------------------

  • RE: Convert of seconds to percentage value

    A simple test and you would get the answer 🙂

    Return type of a datediff is integer and you will get 0 i think. So may be this will help you?...

    ---------------------------------------------------------------------------------

  • RE: cursors and order by

    Lynn's post says it all but in case if it makes easier for you, question would be

    'how do you know that records are not in the order?'

    ---------------------------------------------------------------------------------

  • RE: Total Sales

    Thanks Jeff 🙂

    ---------------------------------------------------------------------------------

  • RE: Number record is more in my join query

    SELECT DISTINCT IPC.PER_NR,

    ISNULL(CHCM.OUTGOING_DATA,IPC.LOA_LEVEL) AS 'Managerlevel'

    FROM

    INBOUND_PLM_CHCM IPC

    LEFT OUTER JOIN CHCM_TO_PSOFT_MAPPING CHCM

    ON IPC.LOA_LEVEL=CHCM.INCOMING_DATA AND...

    ---------------------------------------------------------------------------------

Viewing 15 posts - 106 through 120 (of 463 total)