Forum Replies Created

Viewing 15 posts - 466 through 480 (of 581 total)

  • RE: Indexed View Creation Problem:

    I can't see a reason. I assume none of the columns referenced are indeterministic computed or view columns? Any float (imprecise) data? - I'm clutching at straws now...

  • RE: Understanding Query Plans.

    It's quite a big topic. Here's a basic answer to your question.

    You can view query plans in teh graphical viewer in QA, or as text in the results window/profiler/etc.

    In the graphical...

  • RE: Alternative to Distinct

    Or:

    select

    t1.vc_col, V.stub

    from

  • RE: Recursive Query (Bradcrumb trial-like)

    Based on the sample data from one of the above examples, this is a rough-and-ready outline of teh kind of code you could use. Obviously needs tidying up, but you...

  • RE: How do I...?

    Your explanation makes school and site sound like effectively the same thing, but earlier you said they weren't. Post the DDL for your tables.

  • RE: How do I...?

    Don't use a cursor. The tables you mention don't provide enough information to achieve the result you want. Analysis:

    calendar:
    date,
    isweekend,
    isholiday
     
    semester:
    (schoolid?)
    start,
    end
     
    school:

  • RE: Executing dynamic SQL string within a function

    How about putting this code in a trigger or sp to run when the db list is updated:

    declare

    @sql nvarchar(4000

  • RE: Delete without locking?

    Schedule it to run off-peak, if you have a peak. You might want to look at partitioning your table.  How come you are deleting so much data? Are you archiving...

  • RE: How do I...?

    One would need to know how 'site' relates to 'school'. The DDL would help. A hint: you might want to try using a left (outer) join to exclude certain records.

  • RE: Conversion/migration Query

    select pt.name

    from positions_table pt

    where pt.position_name in
     (select distinct ot.position_name

        from old_table ot)

    group by  pt.name
    having count(distinct pt.id) > 1

  • RE: Conversion/migration Query

    You will need to be sure that you can treat position_name in the positions_table as unique.

    The least stringent check you can make, in case it's of any use:

    select ot.name

    from old_table ot

    where ot.position_name...

  • RE: how to pick a column based on a parameter

    sorry again, should be:
    select
     tab.id
    ,tab.description
    ,tab.stuff
    ,@month M
    ,case @month
     when 1 then tab.M1
     when 2 then tab.M2
    ...
     when 12 then tab.M12
    end M_total
    from
    whatevertable...
  • RE: how to pick a column based on a parameter

    sorry, should be:
     
    select
     tab.id
    ,tab.description
    ,tab.stuff
    ,@month M
    ,case @month
     when 1 then tab.M1
     when 2 then tab.M2
    ...
     when 12 then tab.M12 M_total
    from
    whatevertable tab

     

    I half-changed it from...

  • RE: how to pick a column based on a parameter

    as a short-term fix (until you implement the above recommendation, perhaps with a table holding yearid, monthid, your float value and a FK back to the original table), you can...

  • RE: Arithmetic overflow error converting numeric to data type numeric.

    Sorry my mistake. That was a reconstruction of what we think the original code could have looked like?

Viewing 15 posts - 466 through 480 (of 581 total)