Forum Replies Created

Viewing 15 posts - 1,231 through 1,245 (of 2,171 total)

  • RE: Partitioned view

    Sure. The error I get is "UNION ALL view 'Test.dbo.tOrder' is not updatable because a partitioning column was not found.".

    I know in SQL Server 2005, you can even put the...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: How to Come up with a percentage of a column of True/False Data

    Instead of return 0.45 which in mathematical term is 45%, the algorithm returns 45.0, which most beginners find more appealing.


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: What is my problem in installing Sql Server 2005 Eeterprise Edition?

    I don't think ENTERPRISE EDITION can be installed on MEDIA CENTER.


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Sql Problem

    You may be right.

    We'll never know until OP gets back.

    Other times when I encountered requests for "DISTINCT" posted by people living in India, they have meant non-duplicates.


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Sql Problem

    I think {1, 3, 4, 6, 8} is not the DISTINCT records.

    They are one from each combination of Name and EmailID.

    Maybe that is what OP really want?

    Records {3, 8} are...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Sql Problem

    Op wrote "Now I want distinct records based on name and EmailId..."

    If you want all DISTINCT records, use COUNT and RecID = 1

    If you want all NON-DISTINCT records, use COUNT...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Sql Problem

    Jason Selburg (10/10/2007)


    You want row_number() not count(*) ....

    Why?

    ALL groups of records always start with 1, both distinct and non-distinct groups...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Sql Problem

    If you ARE using SQL Server 2005, make sure COMPATIBILITY LEVEL is set to 90.


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Sql Problem

    SELECTID,

    Name,

    EmailID,

    Age,

    Salary

    FROM(

    SELECTID,

    Name,

    EmailID,

    Age,

    Salary,

    COUNT(*) OVER (PARTITION BY Name, EmailID) AS RecID

    FROMTable1

    ) AS d

    WHERERecID = 1


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: How to Come up with a percentage of a column of True/False Data

    SELECT QuestionID,

    Yes,

    Yes / Answers,

    No,

    No / Answers,

    Answers

    FROM (

    SELECT QuestionID,

    SUM (CASE WHEN Answer = 1 THEN 100.0 ELSE 0.0 END) AS Yes,

    SUM(CASE WHEN Answer = 0 THEN 100.0...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Traversing Herarchies

    Use a CTE.

    They are described in Books Online. There are also examples of how to traverse hierarchies with recursive CTE's.


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: cast and convert

    Very detailed information about why it doesn't work is posted here

    http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=90715


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Help Please

    Delete rows in batches?

    SET ROWCOUNT 20000

    WHILE 1 = 1

    BEGIN

    DELETE FROM Table1 WHERE ID BETWEEN 200000 AND 2200000

    IF @@ROWCOUNT = 0 BREAK

    END

    SET ROWCOUNT...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Complex Count/Sum

    SELECT SUM(CASE WHEN Col2 = 'qwerty' AND Col3 = 1 AND Col4 = 'Fast' THEN Col1 ELSE 0 END) AS 'Option1',

    ...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Remove Decimals Without Rounding

    DECLARE @Sample TABLE (d DECIMAL(5, 4))

    DECLARE @original DECIMAL(6, 4)

    SET @original = 0.0

    WHILE @original < 10.0

    BEGIN

    INSERT @Sample

    SELECT @original

    SET @original = @original + 0.0001

    END

    SELECT d AS OrignalValue,

    REPLACE(REPLACE(REPLACE(RTRIM(REPLACE(REPLACE(STR(d, 15, 5), ' ', '#'),...


    N 56°04'39.16"
    E 12°55'05.25"

Viewing 15 posts - 1,231 through 1,245 (of 2,171 total)