Forum Replies Created

Viewing 15 posts - 2,551 through 2,565 (of 4,085 total)

  • RE: Issue with query

    durga.palepu (6/28/2016)


    It says the problem with converting the expression to int.

    I see only the date expression in this query, do you use any other expression also?

    Also you can rewrite date_begin...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Merge statement with conditions

    Phil Parkin (6/24/2016)


    Paul White suggests that the NOT EXISTS ... INTERSECT form produces better query plans than the EXCEPT form, and that's why I use it. See here (in the...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Find value is prim or not

    I think that Luis' solution will perform faster than any looping solution, especially once the square root short circuit is added.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Merge statement with conditions

    Phil Parkin (6/24/2016)


    UPDATE is probably better than MERGE.

    If you are a fan of MERGE, please take a read of this[/url] and decide whether, perhaps, you should reconsider.

    And rather than using...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: How to make this data into a pivot table

    By definition, an aggregate combines separate elements into one whole. This is exactly what you are doing with a pivot, which is why a pivot requires an aggregate. ...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Convert IIF to CASE - Help review conversion.

    , CASE

    WHEN [Type] = 1 THEN 26

    WHEN [Type] = 2 THEN 27

    ...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Get results from yesterday if datetime betwen 00:00:00 and 06:00:00

    You don't need CASE statements.

    select *

    from tickets

    where ticketdate = CAST(DATEADD(HOUR, -6, GETDATE()) AS DATE)

    If you have a range that you are trying to fit into another range of the same...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: problem converting date on procedure.

    The problem is that you are trying to add a string to a date.

    set @SQLQuery = 'SELECT RequestDate, IP, RequestID, CustomerID, LoanID, Ranking FROM ' + @TableName + 'where RequestDate...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: reset counter by year / month / day

    Luis Cazares (6/20/2016)


    Don't forget to add the year as well.

    An alternative to get both in a single function is to convert them to a string: CONVERT(char(6), yourDateColumn, 112)

    I'm not sure...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Syntax error using WITH

    BrainDonor (6/15/2016)


    First of all, you don't need a CTE for this. The CTE would be useful if you were transforming the data prior to inserting it (at a basic level...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Hierarchical data

    @jeff,

    Thanks. It should be fixed now.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Merge Multiple Columns in to One

    Jacob Wilkins (6/13/2016)


    You could do something like this:

    SELECT X1,

    AllVar

    FROM your_table

    CROSS APPLY

    ...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Update a column in one table based on a not null value in a joined table

    pharmkittie (6/11/2016)


    Thanks drew.allen for your help. I need to update the joined table only once per month but it should be "triggered" when the table without the Boolean value...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Hierarchical data

    After 390+ visits, you should know how to post data to a forum to get the best results. I have a link in my signature if you need a...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • use a view instead of directly accessing the table.
  • use a trigger
  • It helps to understand the issues with triggers so that you can determine whether to use...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 15 posts - 2,551 through 2,565 (of 4,085 total)