Forum Replies Created

Viewing 15 posts - 3,811 through 3,825 (of 10,144 total)

  • RE: T SQL QUERY TO GROUPING SEQUENTIAL DATES IN SQL SERVER.

    Please stop shouting.

  • RE: Return random records in a table-valued function?

    Jeff Moden (1/2/2014)


    You can also just create a view called (for example) ANewID that generates a GUID as a single column, single row result and simply join to it as...

  • RE: Return random records in a table-valued function?

    pietlinden (1/2/2014)


    Jeff,

    I think that's how I got the random number of records per enrollment so that the distribution is irregular. I noticed that Chris's code returns the same number...

  • RE: sort by serialcode

    sayedkhalid99 (1/3/2014)


    ... after 1.3 , 1.5 shall come and then 1.10....

    1.10 usually sorts before 1.3. If this is the case, try casting to decimal:

    SELECT * FROM @Result ORDER BY CAST(Serial...

  • RE: Need help with the query.........

    dwain.c (1/2/2014)


    ChrisM@Work (1/2/2014)


    ... for now we've got a rusty car wheel, a piece of lime green chalk and a small fish!

    No small fish allowed.

    Missed the prefix "sail" 😛

  • RE: Need help with the query.........

    dwain.c (1/2/2014)


    pietlinden (1/2/2014)


    But what if it's a Babelfish and I need it to speak T-SQL?

    You can use:

    EXEC sp_translate @SourceLanguage='gibberish', @TargetLanguage='T-SQL'

    This comes in very handy when all you've got for a...

  • RE: Unable to convert character to datetime

    That will give you date but not time. The code I posted returns datetime, from which you can extract both date and time

    CAST(CAST(CounterDateTime AS CHAR(23)) AS DATETIME)

    and it's intuitive too...

  • RE: Unable to convert character to datetime

    SELECT

    x.CounterDateTime, -- stare & compare

    [Date] = CONVERT(VARCHAR,x.CounterDateTime,101),

    [Time] = RIGHT(CONVERT(VARCHAR,x.CounterDateTime,0),7)

    FROM (-- "Native" CounterDateTime looks similar to this

    SELECT CounterDateTime = '2013-12-30 12:09:00.123' + CHAR(10)) d

    CROSS APPLY (-- so convert it...

  • RE: Unable to convert character to datetime

    Rando (1/2/2014)


    Still searching for a solution. Scott's solution yield's syntax errors and Chris' solution yields the entire date field...

    Again, I'm just looking for the results to be the following;

    Date: 12/30/2013

    Time:...

  • RE: Need help with the query.........

    kapil_kk (1/2/2014)


    ChrisM@Work (1/2/2014)


    FOR XML PATH is used for concatenating values from different rows - the value you are attempting to assemble is a concatenation of values on the same row....

  • RE: Need help with the query.........

    FOR XML PATH is used for concatenating values from different rows - the value you are attempting to assemble is a concatenation of values on the same row. Just use...

  • RE: group by, distinct not working as expected

    Just a thought...what's this meant to do?

    (dbAddDate >= '2013-01-01' OR '2013-01-01' = '')

    AND (dbAddDate <= '2013-12-31' OR '2013-12-31' = '')

  • RE: DB server comes to a crawl every two weeks

    Grab actual query plans for whatever query is responsible for "Existing orders with 200 lines take 10 minutes to retrieve."

    One plan from when response is fast, one plan from...

  • RE: group by, distinct not working as expected

    Try this as a test:

    SELECT

    dbPatID,

    dbAddDate,

    dbStaffLastName,

    RefTypeWord = MAX(RefTypeWord)

    FROM EPSReferralKPIs

    WHERE

    dbAddDate >= '2013-01-01' OR '2013-01-01' = ''

    AND dbAddDate <= '2013-12-31' OR '2013-12-31' = ''

    AND dbStaffLastName IN ('Swanepoel','Patient','Pelletti','Ray','Qureshi','Grobler','Hedborg','De Kock','Lima','Check...

  • RE: group by, distinct not working as expected

    What about the other columns? Can you show a few rows of what you have and what you would like to see? Remember - we can't see what you can,...

Viewing 15 posts - 3,811 through 3,825 (of 10,144 total)