Forum Replies Created

Viewing 15 posts - 1,741 through 1,755 (of 2,171 total)

  • RE: Pivot table for Microsoft SQL Server

    The article was re-released today, so don't take it personal 

    About PIVOT and UNPIVOT in SQL Server 2005; I have more use for UNPIVOT...

  • RE: Working with Numbers

    Here is an explanation of how DATEDIFF works. It applies to hours as well.

    http://www.sqlteam.com/item.asp?ItemID=26922

     

  • RE: Select w/ Max

    And since this is a SQL Server 2005 forum, why not post a better performing query, than Mark's?

    DECLARE

    @Sample TABLE (Truck_ID...

  • RE: Select w/ Max

    Yes. But is it the right one? Mine also works according to original posting.

    It's a matter of interpretation. Until original poster comes back, all we can do is guessing.

  • RE: Eliminate Duplicate rows

    I don't get duplicates with this

    -- Prepare sample data

    DECLARE

    @Sample TABLE (PART_ID INT, DATE...

  • RE: Where is the one place that you should definitely NOT ...

    I meant like creating a new aggregate function MEDIAN.

    SELECT MIN(Col1), MAX(Col1), STDEV(Col1), AVG(Col1), MEDIAN(Col1) FROM Table1

     

  • RE: Eliminate Duplicate rows

    SELECT

    t1.PART_ID,

    t1.DATE,

    t1.PART_CD,

    t1.REN_CD,

  • RE: Eliminate Duplicate rows

    If you are using SQL Server 2000, why do you post a question in the SQL Server 2005 forum?

     

  • RE: Where is the one place that you should definitely NOT ...

    So with CLR you can extend the T-SQL language, or just write new functions, just like UDF?

     

  • RE: Delete all data

    SET NOCOUNT ON

    DECLARE @Constraints TABLE

     (

      ConstraintID SMALLINT IDENTITY(0, 1),

      UNIQUE_CONSTRAINT_CATALOG NVARCHAR(128),

      UNIQUE_CONSTRAINT_SCHEMA NVARCHAR(128),

      UNIQUE_CONSTRAINT_NAME NVARCHAR(128),

      CONSTRAINT_CATALOG NVARCHAR(128),

      CONSTRAINT_SCHEMA NVARCHAR(128),

      CONSTRAINT_NAME NVARCHAR(128),

      TABLE_CATALOG NVARCHAR(128),

      TABLE_SCHEMA NVARCHAR(128),

      TABLE_NAME NVARCHAR(128)

    &nbsp

    INSERT  @Constraints

      (

       UNIQUE_CONSTRAINT_CATALOG,

       UNIQUE_CONSTRAINT_SCHEMA,

       UNIQUE_CONSTRAINT_NAME,

       CONSTRAINT_CATALOG,

       CONSTRAINT_SCHEMA,

       CONSTRAINT_NAME,

       TABLE_CATALOG,

       TABLE_SCHEMA,

       TABLE_NAME

     &nbsp

    SELECT  rc.UNIQUE_CONSTRAINT_CATALOG,

      rc.UNIQUE_CONSTRAINT_SCHEMA,

      rc.UNIQUE_CONSTRAINT_NAME,

      tc.CONSTRAINT_CATALOG,

      tc.CONSTRAINT_SCHEMA,

      tc.CONSTRAINT_NAME,

      kcu.TABLE_CATALOG,

      kcu.TABLE_SCHEMA,

      kcu.TABLE_NAME

    FROM  INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc

    INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE...

  • RE: Eliminate Duplicate rows

    Try this SQL Server 2005 approach

    SELECT

      PART_ID,

            DATE,

            PART_CD,

            REN_CD

  • RE: Eliminate Duplicate rows

    NEW INFORMATION?

    You are using DTS to determine the rows to exclude?

    You always can create a TEMP table.

    Please try the suggestions first before dissing them!

     

  • RE: run a program as a result of a trigger?

    The path to the application is RELATIVE to the SQL Server machine.

     

  • RE: Case statement with other variable

    CASE

    WHEN code= '#' Then 'A'

    WHEN code = '$'

  • RE: IF NOT EXISTS

    You have to do an "UPSERT".

    First an UPDATE

    UPDATE t1

    SET t1.ColX = t2.Col1

    FROM Table1 AS t1

    INNER JOIN Table2 AS t2 ON t2.ColBlue = t1.ColWarm

    Then an INSERT

    INSERT Table1 (ColA, ColB, ColC)

    SELECT...

Viewing 15 posts - 1,741 through 1,755 (of 2,171 total)