Forum Replies Created

Viewing 15 posts - 5,971 through 5,985 (of 6,037 total)

  • RE: How can I execute a query stored in a text field

    CREATE PROCEDURE dbo.MyProc @Script ntext

    AS

    ......

    GO

     

    EXEC dbo.MyProc ''

    and assign your SQL string to @Script inside SP.

     

    _____________
    Code for TallyGenerator

  • RE: Grouping problem - or is this possible at all?

    And "E4.EmpId <=E.EmpId" is priority for employees to be returned.

    If you want another criteria choose another unique key for employees - join date, duration period on the job, etc.

    _____________
    Code for TallyGenerator

  • RE: Grouping problem - or is this possible at all?

    Try this:

    SELECT *

    FROM (select E1.EmpId, E1.EmpName, E2.ReportTo from Employee E1

       inner join Employee E2 on E1.ReportTo = E2.EmpID

      where E2.ReportTo IS NULL) TL

    INNER JOIN Employee E on E.ReportTo = TL.EmpId

    WHERE (SELECT COUNT(EmpId)

      From...

    _____________
    Code for TallyGenerator

  • RE: Create a view from a view

    Indexed view is a table, in fact.

    When you select data from indexed view you don't run the query because data is already prepared for selecting.

    Query is being run every time...

    _____________
    Code for TallyGenerator

  • RE: Create a view from a view

    View is just a piece of code for retrieving data.

    This code is compiled first time it's being used and is stored in database compiled until you change it.

    Using view is...

    _____________
    Code for TallyGenerator

  • RE: Calculated Member

    First and dummiest: single quote instead of double quote.

    _____________
    Code for TallyGenerator

  • RE: Bug in Enterprise Manager

    When you press "Restore DB" EM runs set of queries searching for physical devises, last backups, etc.

    8 queries in total.

    Run profiler and find out which query causes your error.

    Probably it's...

    _____________
    Code for TallyGenerator

  • RE: Sum and Group by

    0,1,2 -> /3 = 0

    If you need to group weeks 1,2,3 then you need to substract 1 from those values.

    If you need to group 2,3,4 then substract 2.

    _____________
    Code for TallyGenerator

  • Viewing 15 posts - 5,971 through 5,985 (of 6,037 total)