Forum Replies Created

Viewing 15 posts - 3,331 through 3,345 (of 4,085 total)

  • RE: One thing I keep missing in SQL

    I don't know if it's "better" than a CTE, but you can use CROSS APPLY

    select

    A,

    ...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Advice on BINARY_CHECKSUM or Alternatives

    Peter Brinkhaus (2/7/2012)


    As an alternative, you could use NOT EXISTS (SELECT [@Stag].* INTERSECT SELECT [@Prod].*) to compare rows.

    Using EXCEPT should give you the same results, is probably more efficient, and...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Extended Latin Character - Need help on storing in my DB

    You need to make sure that your literal string is Unicode. Compare the following results where the first literal is ASCII and the second is Unicode.

    SELECT 'A a A...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Help With Select Statement

    Take a look at EXCEPT which performs a set difference, which is what you are looking for. It makes it much clearer that you are doing a set difference...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Database Issue--Please Help

    The SQL query is first compiled and then executed. Some SQL statements will allow you to use optimistic name resolution to refer to objects that have not yet been...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: One to Many Relationship Question - PLEASE HELP!

    Use an OUTER APPLY

    SELECT m.[property_id]

    ,m.[Address]

    ,m.[City]

    ,m.[Zip]

    ,m.County

    ,m.Bedrooms

    ,m.Bathrooms

    ,m.HalfBathrooms

    ,m.[V_O]

    ,m.[Stars]

    ,m.Rehab

    ,m.Open_bid

    ,m.Notes

    ,m.date_time_changed

    ,i.imagepaththumb

    FROM [Master] m

    OUTER APPLY (

    SELECT TOP (1) impagepaththumb

    FROM Image

    WHERE property_id = property_id_fk

    ) AS i

    where Active_Month='Y'

    ORDER BY m.[V_O] DESC

    ,m.date_time_changed desc

    ,m.[Address] ASC

    You could also use ROW_NUMBER(), but I...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: INSERT NUMBER OF ROWS BASED ON NUMBER VALUE IN ANOTHER TABLE COLUMN

    Martin Schoombee (1/27/2012)

    Take note though that it would require a triangular join, which is generally bad for performance.

    I wouldn't classify this as a triangular join. A triangular joins assumes...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: AS400 SQL Query

    mbrady5 (1/26/2012)


    How would you like to see some sample data? What format etc?

    See the following link.

    Forum Etiquette: How to post data/code on a forum to get the best help[/url]

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Query help -

    In addition, I think you need to change the comparisons on these.

    Datediff(dd,receivedDate,getdate()) >= b.Days

    AND Datediff(dd,receivedDate,getdate()) < b.Days - 5

    By the law of transitivity, if n > d and d...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Query help -

    Guras (1/26/2012)


    I am working on SQL server 2008 R2

    I have a table as following TableA

    clientcode | days

    101 | 30

    101 | 60

    105 | 15

    I need to build the...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: AS400 SQL Query

    Don't construct SQL commands in SSRS. Create a stored procedure and pass the SSRS parameters into the stored procedure.

    Do you really need both a FULL OUTER JOIN and a...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Query Help...very slow running

    You're WHERE clause is not SARGable, because of the conversion of the timestamp field to character. Functions on fields generally prevent them from being SARGable, meaning that you cannot...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: aggregation, still learning how to produce results - please help #3

    Joe's posts on here have convinced me never to buy his books. He believes that he is being authoritative when he's just being authoritarian. He states opinion as...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Numerical datatypes & the quirkiness within

    SJTerrill (1/23/2012)


    I'm no finance guru, so could someone explain to me what real-world situations would require me to multiply/divide one currency value by another? Interest rates aren't currency... they're percentages....

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Numerical datatypes & the quirkiness within

    It's simple. Check out the following webpage on Precision, Scale, and Length.

    Specifically it says that datatypes other than decimal have a fixed precision and scale. The scale for...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 15 posts - 3,331 through 3,345 (of 4,085 total)