Forum Replies Created

Viewing 14 posts - 1 through 14 (of 14 total)

  • RE: A Developer's scalar UDF is takeing this query from 3 seconds to over 5 minutes to run

    If the extended field only use 4 or less values, perhaps we could use the parsename udf.

    My simple bm

    ALTER FUNCTION [dbo].[fx_ArrayList_mod]

    (

    @ProdCode as varchar(max),

    @ProdQty as varchar(max)

    )

    RETURNS decimal(18,3)

    BEGIN

    ...

  • RE: Issue in OPENROWSET

    Perhaps, you can try to find an appropriate download for 64bits Jet. I ran into similar problem using 2008R2 against earlier office, decided not to fight that battle -...

  • RE: Has anybody constructed dynamic SQL by storing SQL in fields in tables?

    Whenever a team of ppl using a foreign (brainwise) power tool and compounded over time, voi'la a big mess -> time to call the experts.

    Neverthelss, power tools juggling can...

  • RE: a=b=c?

    -- fun bits

    declare @a int=123, @b-2 int=123, @C int=123, @d int=123

    select case when (@a & @b-2 & @C & @d)...

  • RE: Avoiding insertion of duplicate rows

    insert tableb(lname,fname,phoneno)

    select a.lname,a.fname,a.phoneno

    from tablea a

    left join tableb b on a.lname=b.lname and a.fname=b.fname and a.phoneno=b.phoneno

    where b.id is null

    A longer version of Ninja's suggestion...

  • RE: How will you write a query for this scenario

    Vermarajiv - here is a better WHILE w/o using expensive btree DELETE:

    SET NOCOUNT ON -- elim intmed display, note: @@rowcount is not affected

    CREATE TABLE #t (pid int, dt datetime)

    INSERT...

  • RE: Funny calculation and grouping problem

    Run a quick test on my dev-server (1proc 4cores 8GB, SSD)

    a+0.0 : 1700ms

    a*1.0 : 1606ms

    and

    declare @r decimal(38,20)

    select @r = SUM(a)*1.0 -- cast(COUNT(*) as...

  • RE: Funny calculation and grouping problem

    Hi Ninja,

    I wonder if the conversion is outside of the aggregate, would perf improves?

    'avg'=sum(Value)/cast(COUNT(*) as float)

    ...ignoring sum() int overflow scenario.

  • RE: Filter challenge

    Yes, similar to EXISTS however the original post omitted the groupid predicate and pain-avoidance from the past I don't like EXISTS in the WHERE clause - perhaps sql4.3 days spooked...

  • RE: Filter challenge

    Using Paul's temp table, here is an alternate qry using divide & conquer (90's oldies).

    SELECT t.*

    FROM #mycodes t

    INNER JOIN (

    ...

  • RE: How to eliminate all NULL columns...

    There isn't much room to improve over stewartc-708166's answer: all AND on(Col0-49 is not null). My app(C# & SQL) requirement test for all and group of columns, e.g subscriptions,...

  • RE: Stock Aging Query

    I've done this type of stock age/drawn queries before - using non loop/cursor (prior to cte). David's code is almost there and shown why CTE is cool - all...

  • RE: PatIndex

    Agree, boundaries cases always tricky and usually obmitted in specs ...

  • RE: PatIndex

    If this question is a joke -> heheh <= I'm god on FEBRUARY 30th+ (leapy).

    Well, this code will work (hey it's tested 😉

    declare @t1 table(y decimal(4), m decimal(2))

    declare @t2 table(d...

Viewing 14 posts - 1 through 14 (of 14 total)