Forum Replies Created

Viewing 15 posts - 376 through 390 (of 595 total)

  • RE: Any suggestion for sql query optimization in sql

    OK, here goes:

    1) Remove the INDEX HINT. Let SQL Server optimize on its own; it will usually pick the right path if the SQL is well-written.

    2) Use modern SQL...

  • RE: DELETE DUPLICATE ROWS

    Try:

    DELETE FROM Orders

    FROM Orders

    INNER JOIN

    (

    SELECT Order_No, Line_No, MAX(Ship_Date) as MaxShipDate

    FROM Orders

    GROUP BY Order_No, Line_No

    ) AS dt

    ON Orders.Order_No = dt.Order_No

    AND Orders.Line_No = dt.Line_No

    AND Orders.Ship_Date <> dt.MaxShipDate

  • RE: Partition table

    Option 1:

    You can vertically partition a table by splitting the structure of a table into multiple tables based on column. For instance, you can have a main table with...

  • RE: Aggregate functions - First, Last, Max, Min etc

    quote:


    ..can anyone out there think of a workaround?...


    What are you trying to work around?...

  • RE: Aggregate functions - First, Last, Max, Min etc

    quote:


    In Access, the First and Last functions allow you to retrieve the first or last value (field) within a Group...


  • RE: Aggregate functions - First, Last, Max, Min etc

    What's the difference between MIN and First and MAX and Last. YOu can also use TOP clause and the order by clause to produce the results needed.

    Edited by -...

  • RE: setting in sql

    Don't mess with the system tables. Enterprise Manager has a GUI for modifying server logins and roles, and database users and roles. Click to the Server --> Security...

  • RE: nvarchar datatypes

    The NVARCHAR data type is for Unicode character sets. If you don't need Unicode character set, use VARCHAR, which is single byte-wide character set as opposed to 2-byte wide...

  • RE: Storing Document (xls) in tables

    I know this sounds like a stupid question, but why not just let the file system do what it's designed to do and just store the path in the DB?

    ...

  • RE: Simple T-Sql that's driving me nuts!

    here you go:

    select table.c1, table.c2, table.c3, dt.count_c1

    from table inner join

    (

    select c1, count(*) as count_c1

    from table

    group by c1

    having count(*) > 1

    ) as dt on table.c1 = dt.c1

  • RE: Aggregate functions - First, Last, Max, Min etc

    Look in BooksOnline for Aggregate functions:

    MIN(), MAX(), AVG(), SUM(), COUNT()...

  • RE: setting in sql

    quote:


    where do you adjust all the major settings in sql? is it done in enterprise manager?


  • RE: AS clause/WHERE clause

    quote:


    Hi,

    This query..

    select distinct id,

    count(id) as id_counter

    from x

    where id_counter > 1

    wouldnt work because you are using a aggregate in the select...

  • RE: AS clause/WHERE clause

    Sure thing. Just put the original query inside a derived table:

    
    
    select * from
    (
    select id,
    count(*) as id_counter
    from x
    group by id
    ) as derived_table
    where id_counter...
  • RE: datepart(dw,getdate())

    OK, in BOL, the article says:

    quote:


    Remarks

    Use the @@DATEFIRST function to check the current setting of SET DATEFIRST.

    The setting of SET DATEFIRST is...

Viewing 15 posts - 376 through 390 (of 595 total)