SQL Server Performance

about return result correctly for executing twice t-sql

Discussion in 'SQL Server 2008 General DBA Questions' started by sthuman, May 5, 2010.

  1. sthuman New Member

    I found this T-sql need to be executed twice for correct result since upgrading from sql2000 to sql2008.
    Table structure:
    CREATE TABLE [dbo].[Cname1](
    [no] [int] NOT NULL,
    [country_no] [char](5) NOT NULL collation SQL_1xCompat_CP850_CI_AS,
    [CCoName1] [char](62) NULL collation SQL_1xCompat_CP850_CI_AS
    ) ON [PRIMARY]

    Index:
    index_name index_description index_keys
    CCoName1_ind clustered, unique located on PRIMARY CCoName1, no
    duns_no_ind nonclustered, unique located on PRIMARY no(-)
    The T-Sql:
    select no,CCoName1 from cname1 where (country_no='156' or country_no='-156') and cconame1>='content'
    I try to rebulid index many times and it was of no effect.
    Pls give me some suggestions
    Thanks.
  2. Madhivanan Moderator

    How did you know it returns result only after second execution?
    You may need to post some sample data with expected result

Share This Page