Forum Replies Created

Viewing 15 posts - 76 through 90 (of 114 total)

  • RE: Unable to Aggregate by name to generate SUM totals

    I'm not sure i follow the problem...the SQL you posted should return exactly what you are looking for. The problem may be in how you are putting the data...

    --------------------------------------------------------------------------
    When you realize you've dug yourself into a hole....Step 1...stop digging.

  • RE: Finding duplicate values in very large table. Select Row_number() over too slow

    Couldn't you just do a COUNT/HAVING approach?

    Select Field1, Field2, COUNT(*) AS Records

    FROM SUMMARY_TABLE

    GROUP BY Field1, Field2

    HAVING COUNT(*) > 1

    That will identify the multiple occurrences and from there you can resolve...

    --------------------------------------------------------------------------
    When you realize you've dug yourself into a hole....Step 1...stop digging.

  • RE: Lost table Identity

    no those won't work. they are used to allow you to insert the identity values in your SQL INSERT statements.

    You need to alter the table and redefine the field...

    --------------------------------------------------------------------------
    When you realize you've dug yourself into a hole....Step 1...stop digging.

  • RE: View - Need Dynamic From Clause for Cross Server Select/Join

    You could use a table valued function instead of a view. That would return a table.

    On a different note, have you thought of just defining the server Aliases differently...

    --------------------------------------------------------------------------
    When you realize you've dug yourself into a hole....Step 1...stop digging.

  • RE: Select data and update a linked table

    here ya go...

    Update Contact

    Set Temp = 'on course'

    FROM wce_course_delegate_link_2 AS d

    INNER...

    --------------------------------------------------------------------------
    When you realize you've dug yourself into a hole....Step 1...stop digging.

  • RE: If a database contains Fact and Dimension tables, do we call that database as datawarehouse?

    Yes the data warehouse is often considered the database. However, the surrounding systems are often referred to by end users as the data warehouse.

    --------------------------------------------------------------------------
    When you realize you've dug yourself into a hole....Step 1...stop digging.

  • RE: Dynamic IN statement

    Without knowing the reason you need a dynamic IN operation, your solution to avoid Dynamic SQL is fine. That being said, the creation / insertion / deltion of the...

    --------------------------------------------------------------------------
    When you realize you've dug yourself into a hole....Step 1...stop digging.

  • RE: Sub Query problem

    You also have a join using the same field on both sides of the equation (Cartesian):

    IM.Item_ID = IM.Item_ID

    That's gonna hurt ya.

    --------------------------------------------------------------------------
    When you realize you've dug yourself into a hole....Step 1...stop digging.

  • RE: Sub Query problem

    You are also using the DATEPART function to just get the day, but in your example data you want the date. If you want to strip off the time...

    --------------------------------------------------------------------------
    When you realize you've dug yourself into a hole....Step 1...stop digging.

  • RE: Two different sub-exec plans?

    SQL can recompile specific lines within a stored procedure, which is what I think you are experiencing here. I would not worry about it unless there is a performance...

    --------------------------------------------------------------------------
    When you realize you've dug yourself into a hole....Step 1...stop digging.

  • RE: Two different sub-exec plans?

    To answer the question (Is there something I should worry about)...I would say no...mostly. SQL Server will not keep multiple plans in the cache. This means that you...

    --------------------------------------------------------------------------
    When you realize you've dug yourself into a hole....Step 1...stop digging.

  • RE: Procedure fails when called from a job

    Let me start by saying this is pretty difficult to debug without more knowledge of the procedure and the changes you made.

    That said for the dynamic SQL, you should be...

    --------------------------------------------------------------------------
    When you realize you've dug yourself into a hole....Step 1...stop digging.

  • RE: Can this query be written more efficiently ?

    Are you looking to get a list of all the records or are you planning on adding a WHERE clause above and beyond your "show me the latest FirstTime" for...

    --------------------------------------------------------------------------
    When you realize you've dug yourself into a hole....Step 1...stop digging.

  • RE: Find Employees how are in perticular Title any time during the year

    Lowell's is better than mine as it takes the possibility of not having a history record into account. Heh heh.

    --------------------------------------------------------------------------
    When you realize you've dug yourself into a hole....Step 1...stop digging.

  • RE: Find Employees how are in perticular Title any time during the year

    we can't really give you the SQL to use as we don't have the table structures, however assuming that EmpID is the key in your EmpTable and that EmpHistory has...

    --------------------------------------------------------------------------
    When you realize you've dug yourself into a hole....Step 1...stop digging.

Viewing 15 posts - 76 through 90 (of 114 total)