Forum Replies Created

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

  • RE: not using index

    Oh, you did not?

    That's deinetely it!

    _____________
    Code for TallyGenerator

  • RE: can I take rows of data to split between two tables

    Don't forget about OPENQUERY. It will help you access XLS sheets as normal tables or views without downloading it into temp tables.

    Don't forget to add $ in the end...

    _____________
    Code for TallyGenerator

  • RE: Dynamic SQL help.

    Your "Use ..." is out of scope. It works only within script you run via EXEC.

    As soon as it's finished you are back to your original environment.

    Add call for SP...

    _____________
    Code for TallyGenerator

  • RE: Empty Dates into SQL

    Yes, there is, they name it "NULL".

    _____________
    Code for TallyGenerator

  • RE: Reindexing all tables ... am I missing something (likely ...)

    Use this:

    DECLARE @TName sysname, @IndId int, @Query varchar(4000)

    DECLARE index_cursor CURSOR

       FOR SELECT sysobjects.name, sysindexes.indid FROM sysobjects

     Inner join sysindexes on sysobjects.id = sysindexes.id

    where OBJECTPROPERTY(sysobjects.id, N'IsUserTable') = 1

     and sysindexes.indid between 1 and 250

    order...

    _____________
    Code for TallyGenerator

  • RE: Select next 100 rows

    SELECT C.*

    FROM dbo.Customer c

    INNER JOIN (SELECT c2.CustID, (SELECT COUNT(*)

                                   FROM dbo.Customer C1

                                  WHERE C1.CustID <=C2.CustID) as Row_Numb

               FROM dbo.Customer c2 ) C0 on C0.CustID =C.CustID

    WHERE Row_Numb between 

    _____________
    Code for TallyGenerator

  • 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

  • RE: Sum and Group by

    GROUP BY (Number_of_the_week - 1)/3

    GROUP BY (Number_of_the_week - 1)/6

    _____________
    Code for TallyGenerator

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