Forum Replies Created

Viewing 15 posts - 1,411 through 1,425 (of 3,957 total)

  • RE: ORDER BY clause based on values IN ()

    I was assuming you dynamically built the query in the front end so could handle splitting the items that are part of the IN clause.

    Alternatively, something like this will also...

  • RE: Problem with writing a query. Kindly guide...

    Sean Lange (9/26/2013)


    Thanks to hunchback for the ddl and data. Here is another way to do the same thing.

    select Rate

    from @T

    cross apply (select count(*) as RowsCount from @t where rate...

  • RE: Newbie needs help with a query!!

    Personally, if I couldn't correct it on data capture and in the table definition, I'd probably convert it to a TIME data type and do my validation from there.

    SELECT *

    ...

  • RE: ORDER BY clause based on values IN ()

    How about this?

    SELECT field1, field2, field3

    FROM table

    WHERE field1 IN (83944, 83955, 83954, 83951,83947, 83946, 83953)

    ORDER BY CASE field1

    WHEN 83944 THEN 1

    ...

  • RE: Calculating Elapsed Times (SQL Spackle)

    tbruce-3350 (9/26/2013)


    lkent (9/26/2013)


    In the healthcare industry, length of stay (LOS) is always fun figuring out how to present the data.

    Usually we only count days stay with a default of 1....

  • RE: Calculating Elapsed Times (SQL Spackle)

    Mauve (9/26/2013)


    lkent (9/26/2013)


    In the healthcare industry, length of stay (LOS) is always fun figuring out how to present the data.

    Usually we only count days stay with a default of 1....

  • RE: how to update column city value from 'A' to 'B' and 'B' to 'A' in single query

    dastagiri16 (9/25/2013)


    hi,

    here i am not able to trust it is updated with 'A'

    supose in cte last select statement can be changed to 'AA' it is not showing last updated record...

  • RE: String Split

    Aadhar Joshi (9/25/2013)


    Thank u all, I appreciate every one here for the solution.

    Finally, i found my own one.

    Please share with us.

  • RE: how to update column city value from 'A' to 'B' and 'B' to 'A' in single query

    I'll get into the spirit of this thing you've got going here!

    CREATE TABLE #MyTable

    (

    city nchar(10)

    );

    INSERT INTO #MyTable VALUES ('A');

    WITH SampleData (city) AS

    (

    SELECT...

  • RE: Rolling 3 month average cost help

    Briceston (9/25/2013)


    Hi guys,

    Below is an example of my data using a create and insert.

    --===== Create the test table with

    Create table Admission

    (Contract Varchar(4),

    Admissiondate Varchar(6),

    SumofCost...

  • RE: Query

    hunchback (9/24/2013)


    You can use some of the string functions like CHARINDEX, PATINDEX, LEFT, SUBSTRING, etc.

    Try to find the first non numeric character and extract the substring from the beginning to...

  • RE: Need urgent help with query

    Why obfuscate such simple logic with a view?

    SELECT CARDNO, [Date]=LEFT(b.strDate, 10)

    ,InTime=SUBSTRING(b.strDate, 12, 5)

    ,OutTime=SUBSTRING(c.strDate, 12, 5)

    FROM table2 a

    CROSS APPLY

    (

    SELECT...

  • RE: Breaking up a string of text

    My advice is plan for the worst and use a pattern split function like the one you'll find in the 4th link in my signature.

    WITH SampleData (Name) AS

    (

    ...

  • RE: Combine CASE for Boolean (is NULL) and Expression

    Like this?

    CASE WHEN C1 IS NULL THEN 'Alpha'

    WHEN C1='' THEN 'Bravo'

    WHEN C1='c' THEN 'Charlie'

    ELSE 'Whiskey' END

  • RE: Creating a recordset from 1 table without a cursor

    I don't think you've got enough information in this table to do this.

    I'm not sure by your post whether you're looking to see an expanded hierarchy or simply the various...

Viewing 15 posts - 1,411 through 1,425 (of 3,957 total)