Forum Replies Created

Viewing 15 posts - 1 through 15 (of 110 total)

  • RE: getting unique records from a table

    GilaMonster (3/25/2008)


    Koji Matsumura (3/25/2008)


    SELECT roll, MAX(sname) FROM Table ORDER BY roll

    SELECT roll, MAX(sname)

    FROM Table

    GROUP BY roll

    ORDER BY roll

    Thank you Gail.

  • RE: getting unique records from a table

    SELECT roll, MAX(sname) FROM Table ORDER BY roll

  • RE: How to solve this ..?

    DECLARE @Table_1 TABLE (Col1 int, Col2 int, Col3 char(4), Col4 char(4))

    INSERT INTO @Table_1 SELECT 1, 101, 'Usr1', 'WRK1'

    UNION ALL SELECT 2, '101', 'Usr2', 'WRK1'

    DECLARE @Table_2 TABLE (Col1 int, Msg char(20))

    INSERT...

  • RE: Isnull function

    GilaMonster (1/4/2008)


    Koji Matsumura (1/4/2008)[hr

    Thank you Gail for the info.

    I guess I was somehow confused with char VS varchar datatype.

    Yeah. The varxxx datatypes have 2 bytes extra to store the data...

  • RE: Isnull function

    GilaMonster (1/4/2008)


    Koji Matsumura (1/4/2008)


    In SQL Server , all representation of the NULL value are the same.

    Nullable datatypes are one byte larger than non-nullable ones.

    Null and not null datatypes are the...

  • RE: Isnull function

    karthikeyan (1/4/2008)


    And,Databases treat NULL values in a special way, depending upon the type of operation that it is used in.

    1) When a NULL value appears as an operand to...

  • RE: Nested Select Statement Optimization

    Jeff Moden (12/28/2007)


    Exactly what I did in my cross-tab code... nice, job, Koji...

    Jeff,

    with SET STATISTICS IO ON

    SELECT TV.Feature, TV.RunStatus, 100.00 * COUNT(*) / B.FeatureCount

    :

    GROUP BY TV.Feature, TV.RunStatus, B.FeatureCount

    :

    Mine above shows

    Table...

  • RE: Nested Select Statement Optimization

    The original query can be optimized as:

    SELECT TV.Feature, TV.RunStatus, 100.00 * COUNT(*) / B.FeatureCount

    FROM @raw AS TV

    INNER JOIN (SELECT Z.Feature, FeatureCount = COUNT(*) FROM @raw Z...

  • RE: Isnull function

    They don't mean the same thing.

    Try

    DECLARE @T TABLE (A int, B char(1))

    INSERT INTO @T SELECT 1, 'A' UNION SELECT 2, '' UNION SELECT 3, NULL

    SELECT * FROM @T WHERE B...

  • RE: Change single return record to multiple

    SELECT loginname, record_date, CAST(((SELECT ((SELECT ((SELECT ((SELECT ((SELECT ((SELECT ((SELECT ((SELECT ((SELECT annual_quota FROM #pipelinehist WHERE loginname = A.loginname AND record_date = A.record_date)

    / (SELECT target_deal FROM #pipelinehist WHERE loginname =...

  • RE: Temp Table Comparison SQL

    SELECT * FROM TempTableA A

    WHERE NOT EXISTS

    (SELECT * FROM TempTableB Z WHERE Z.col1 = A.col1 AND Z.col2 = A.col2 AND Z.col3 = A.col3 AND Z.col4 = A.col4)

  • RE: incorrect syntax for building a string

    You are missing ' at the end of @SQLString1

  • RE: Help on creating sql statement for selecting date within a date

    feeblemind_99 (11/20/2007)


    Hi Koji,

    Yeah I've changed the @Source to my table name and it works! Thanks to that...

    kindly explain to me what the statement is doing from the declaration of a...

  • RE: Help on creating sql statement for selecting date within a date

    feeblemind_99 (11/20/2007)


    Hi Koji, thanks for the help! I tried it and it works.

    Anyways, can you explain to me what happens in the statement that you created?

    Also, in the Insert...

Viewing 15 posts - 1 through 15 (of 110 total)