Forum Replies Created

Viewing 15 posts - 2,116 through 2,130 (of 2,169 total)

  • RE: Group By with no aggregate: Why???

    In most DBMSs, a GROUP BY is a more efficient way to eliminate duplicate rows compared with the DISTINCT keyword. The reason for this is that a GROUP BY invokes...

  • RE: Group By with no aggregate: Why???

    Using without an aggregate causes the resultset to behave like DISTINCT, and is faster.

  • RE: Size of Data Returned from View or Query

    You're welcome.

  • RE: Size of Data Returned from View or Query

    (sum of DATALENGTH for all columns) multiplied with the number of rows gives a rough estimate of the amount of data sent.

  • RE: Best way to do this.....

    Nice. Well done!

    I was so focused on producing the groups, I didn't see the obvious.

  • RE: multiple attachments using xp_sendmail

    yes, that is doable.

    First you must create some kind of a lookup table where every attachment (path & filename) is stored with an ID.

    Second, create another lookup table where you match each...

  • RE: how to parse a T-SQL script to get the tables touched by the query?

    Maybe parsing the query and searching for "FROM " / "UPDATE " / "INSERT INTO " / "INSERT " text, and then a space after that, should give a table...

  • RE: Divide update into batches

    True. I didn't really think...

    WHILE EXIST (SELECT * FROM Account WITH (NOLOCK) WHERE ProviderID = 70 AND IsActive = 0 AND Status <> 'Deleted')

       UPDATE  Listing

       SET     Status...

  • RE: Divide update into batches

    Have you tried

     SET @x = @@rowcount 

    PRINT @x

     SET @cnt = @cnt + @x

    to see what @x gives?

    Otherwise

    WHILE EXIST (SELECT * FROM Account WITH (NOLOCK) WHERE ProviderID = 70 AND IsActive...

  • RE: Calculate Ranking on Records.

    Or do you simple want this?

    -- Populate test data

    declare @t table (prog varchar(8), cost float)

    insert @t

    select 'Prog A', 32.600187121827403 union all

    select 'Prog B',...

  • RE: Calculate Ranking on Records.

    There are three 77.358114112521619

    I ask you the same question again, how would you like ties (same numbers) to be ranked?

    How do you differentiate between equal numbers?

  • RE: Best way to do this.....

    Something like this?

    In this example, IDs must be consecutive, otherwise just create a table variable with ID as IDENTITY and insert into that table first, ordered by...

  • RE: How to extract the last record of the month

    -- Populate test data

    declare @t table (aDate datetime, otherdata varchar(50))

    insert @t

    select '2006-01-01', 'a' union all

    select '2006-01-15', 'b' union all

    select '2006-02-01', 'c' union all

    select '2006-02-02', 'd' union all

    select '2006-02-03', 'e'

    -- Do the work efficient

    select...

  • RE: Best way to do this.....

    Is this same group

    11 2004-05-13 16:54:58.000           C

    12 2004-05-18 12:29:42.000           C

    13 2004-05-18 12:29:43.000           C

    Even if date has changed?

    Could you...

  • RE: Calculate Ranking on Records.

    -- Populate test date

    declare @t table (prog varchar(8), cost int)

    insert @t

    select 'Prog-A', 16000 union all

    select 'Prog-B' ,16000 union all

    select 'Prog-C', 21000 union all

    select...

Viewing 15 posts - 2,116 through 2,130 (of 2,169 total)