Forum Replies Created

Viewing 15 posts - 211 through 225 (of 683 total)

  • RE: SELECT DISTINCT on Long Table

    Steve F. (4/18/2008)


    I just updated the stats with a 20% sample size; this took about 30 minutes. The DISTINCT query's performance does not seem to have improved.

    That's that then....

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: SELECT DISTINCT on Long Table

    Ryan: The stats are updating right now. This takes time. I will try the query once this has completed.

    Thanks Steve.

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: SELECT DISTINCT on Long Table

    assuming the statistics on the table are reasonably up-to-date

    I'm not convinced they are. I'm still waiting for my reply...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: syntax error on '`'

    What do you actually want to do? Update the underlying data? Select the data but change it slightly? What do you want to change it from and to?

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: SELECT DISTINCT on Long Table

    Can't see your query

    Is the Day field indexed?

    Am I seeing a different question to everyone else?

    Anyway... is the index up-to-date?

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Query Help - 3

    Is this any help?

    --SQL 2005 version

    declare @s-2 varchar(1000)

    set @s-2 = 'Company A,Department B,Manager C'

    ; with

    integers1to100(i) as (select 1 union all select i+1 from integers1to100 where i...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Find Affected Row Count from a Dynamic Query

    GilaMonster (4/18/2008)


    I did.

    DECLARE @sSQL NVARCHAR(100), @rowcount INT

    SET @sSQL = 'select * from sysobjects'

    EXEC sp_executesql @sSQL

    SELECT @rowcount = @@ROWCOUNT

    PRINT '@rowcount = ' + CAST(@rowcount AS VARCHAR(4))

    Output in the messages tab -...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Find Affected Row Count from a Dynamic Query

    This might be simpler...

    Replace this...

    EXEC @rowcount = sp_executesql @strSql

    with this...

    EXEC sp_executesql @strSql

    set @rowcount = @@RowCount

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Deserialize data in xml column to a table

    I think you'll have to use dynamic sql to return a dynamic set of columns. I'd write a function which takes the xml and returns a sql query string, and...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Count number of transaction in each period of time

    How's this?

    --data

    declare @transactions table (TransactionDate datetime)

    insert @transactions

    select '20080418 08:31'

    union all select '20080418 09:13'

    union all select '20080418 10:26'

    union all select '20080418...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: How to get Primary Key of all Rows affected in UPDATE statement?

    Well, I've learned something here. Thanks guys 🙂

    I've implemented this in my example to demonstrate it...

    declare @Sample table (id int identity(1, 1) primary key, a int)

    insert @Sample

    ...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Thai Buddhist Calendar format in SQL Server

    Duplicate post.

    http://www.sqlservercentral.com/Forums/Topic486239-149-1.aspx

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Thai Buddhist Calendar format in SQL Server 2005

    2003? Wow - that is crazy.

    I don't see how SQL Server will return anything other than 2008 when you ask it for the year of '12/1/2008'.

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: How to get Primary Key of all Rows affected in UPDATE statement?

    Assuming by 'primary key', you mean an identity column (they're not necessarily the same thing), you can use the technique in this example...

    declare @Sample table (id int identity(1, 1) primary...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: need help badly newbie question

    How's this?

    --Data

    declare @Sample table (error_reference_uid int, item_number int, error_code varchar(10))

    insert @Sample

    select 1234567, 13579, 'odd'

    union all select 1234567, 2468, 'even'

    union all...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

Viewing 15 posts - 211 through 225 (of 683 total)