Forum Replies Created

Viewing 15 posts - 91 through 105 (of 275 total)

  • RE: Help getting total rows from outer select statement

    Not exactly sure what you are basing "rank" and "percentage" on, but maybe you could combine your approaches and reduce the overhead enough to be acceptable:

    SELECT

    ...

    Scott Pletcher, SQL Server MVP 2008-2010

  • RE: I need a better way to do this

    Also, it's risky to base your security practices on read-only access.

    What happens a year from now when the app needs changed to allow UPDATEs / DELETEs? Your security approach...

    Scott Pletcher, SQL Server MVP 2008-2010

  • RE: I need a better way to do this

    Certain conditions make a plan uncacheable as well.

    For example, a literal > 8K. That used to be just a weird quirk, not really applicable in real life ... but...

    Scott Pletcher, SQL Server MVP 2008-2010

  • RE: I need a better way to do this

    SQL Server will cash plan for any query, no matter where it's coming from.

    That's not true.

    Scott Pletcher, SQL Server MVP 2008-2010

  • RE: I need a better way to do this

    my point was that combining correct literal encoding with GRANT SELECT is impervious to "sql injection" attacks when reading data

    Yes, but sometimes users need the capability to UPDATE and, on...

    Scott Pletcher, SQL Server MVP 2008-2010

  • RE: Performance Tuning 40,000,000

    You could try this and see what it does:

    insert into combined_stats_agg

    SELECT r.mf_cd+2000 as mf_cd, r.mkt_id,

    r.mf_dt, c.mf_nm, r.mf_val

    FROM (

    ...

    Scott Pletcher, SQL Server MVP 2008-2010

  • RE: how to do this without a cursor?

    Order1, Line1, 1/1/2010, 1/13/2010, 0 --why 0?

    Order1, Line2, 1/30/2010, 2/15/2010, 17 --1/30 - 1/13?

    Order1, Line3, 2/15/2010, 2/17/2010, 2 --?? why not 0 for 2/15 - 2/15

    Order2, Line1, 1/1/2010, 1/5/2010, 4...

    Scott Pletcher, SQL Server MVP 2008-2010

  • RE: Removing duplicates

    60 rows is probably not a large enough sample to show a performance affect.

    Scott Pletcher, SQL Server MVP 2008-2010

  • RE: Removing duplicates

    I would think GROUP BY would have to be faster than ROW_NUMBER(), since SQL doesn't have to partition and generate row numbers, but it would be interesting to compare the...

    Scott Pletcher, SQL Server MVP 2008-2010

  • RE: Division Formula

    SELECT CAST(CAST(Duration AS decimal(11, 2)) / 3600 AS decimal(6, 2)) AS DurationInHrs

    Scott Pletcher, SQL Server MVP 2008-2010

  • RE: Removing duplicates

    select dataId, code, imageName, min(loadid)

    from @t1

    group by dataId, code, imageName

    Scott Pletcher, SQL Server MVP 2008-2010

  • RE: best way to: where [field] = @field --with set ansi_nulls on

    Nope, nothing better. NULLs must be checked separately.

    Scott Pletcher, SQL Server MVP 2008-2010

  • RE: SUBSTRING

    Lol. Not sure, just an idea that pops into your head.

    When you look at the output of version, you see that the first four consecutive digits in the result...

    Scott Pletcher, SQL Server MVP 2008-2010

  • RE: multiple updates

    Your rollback will likely take at least roughly twice as long as the original updates.

    from dbo.Adm_History2 as ht inner join

    OBBEAVER.USPA_check.dbo.RevID rc on rc.revno=ht.revno

    Do you have an index on rc.revno?

    For...

    Scott Pletcher, SQL Server MVP 2008-2010

  • RE: SUBSTRING

    SELECT SUBSTRING(@@VERSION, PATINDEX('%[0-9][0-9][0-9][0-9]%', @@VERSION), 4)

    Scott Pletcher, SQL Server MVP 2008-2010

Viewing 15 posts - 91 through 105 (of 275 total)