Forum Replies Created

Viewing 15 posts - 391 through 405 (of 475 total)

  • RE: effective way to break a string into rows basing on lenght of string

    Hi

    This should do the trick. You will need to make the tally big enough to split your largest string

    ;with smallTally AS (

    SELECT row_number() OVER (ORDER BY (SELECT NULL)) N...

  • RE: OUTPUT - 1

    Thanks, nice question

  • RE: Restrict overlapping records

    Hi

    If I've understood your question right, you could create a check function for your year ranges and use that in a constraint. Something like:

    CREATE FUNCTION chkOverLap(@fromYear tinyint, @toYear tinyint)...

  • RE: conditional sort in sql

    I may be reading the question wrong, but this may do what you want

    SELECT Columns

    FROM HRCandidateProject

    ORDER BY CASE

    WHEN TotalExperience BETWEEN 1 and 2 THEN 1

    ...

  • RE: Recursion but with some bits ignored

    Yep, you can have multiple queries in your cte. It can make things a lot easier to read and understand, but sometimes I think it may have an...

  • RE: Join between 3 Tables Problem with Select

    Hi

    Try this, it should give the result you want

    with Samples as (

    -- Sample Data

    SELECT * FROM (VALUES ('A','X'), ('A', 'Y'), ('A','Z')) AS S(SampleID, ClassID)

    )

    ,Tests as (

    SELECT * FROM (VALUES(1,'X'),(2,'X'),(3,'X'),(4,'Y'),(5,'Z')) AS...

  • RE: Recursion but with some bits ignored

    Hi

    You're very close to getting the result you want, you just need to combine the results of your drill up with a drill down from FTID, rather than drilling down...

  • RE: Query Help

    Hi

    I think you need some way to group the dates into quarters.

    I'll let someone else suggest the best method as I don't deal with dates frequently and wouldn't want to...

  • RE: SubQuery returns more than 1 value

    No Problem

  • RE: Query Syntax Help

    mikeallenbrown (2/18/2013)


    Great! ...thank you. That worked.

    Yes, PrimDiag is a char field ...probably should be dec(18,2) but a few clients have letters in this field so changing would be problematic.

    No problem....

  • RE: SubQuery returns more than 1 value

    You could use and EXISTS in you case statement rather than an =

    Not sure if I've got you logic right, but something like the following

    -- Some Test Data

    ;with Fact as...

  • RE: Query Syntax Help

    Hi

    Not sure if this is what you want

    SELECT t.SSN, t.StartOfCare, t.PrimDiag, t.ClientID,

    c.[required columns]

    FROM

    (

    SELECT ROW_NUMBER() OVER (PARTITION...

  • RE: Newb with SQL in school learning - class project help

    Hi

    If I've understood your question, you've saved your code using 'Save solution'. If your SQL was copied into a new query window then you would have been prompted for...

  • RE: Alter User

    Nice question thanks.

  • RE: Why does this get me multiple records?

    There are a number of ways of doing this. Here's a few ways of writing essentially the same query.

    SELECT completed, auditdate, a.agentNumber

    FROM tblAudit_AuditSchedule a

    INNER JOIN (

    SELECT agentNumber, MAX(auditdate) maxdate...

Viewing 15 posts - 391 through 405 (of 475 total)