Forum Replies Created

Viewing 15 posts - 1 through 15 (of 154 total)

  • RE: Last-Date performance issues

    The first query should be faster , if you had the appropriate indexes on

    Customers.Country and composite on Orders.CustomerId + Orderdate (or clustered on Customerid)

  • RE: Swapping and nudging items

    Glad to,

    Generally constructs like these

    @direction * sort make the where clause unsargable -

    you can check the query plan...create indexes on id & sort fields seperately ...

    ( composite won't...

  • RE: Swapping and nudging items

    sometimes the best solution is the simplest

    CREATE PROCEDURE Usp_MoverItemTest1 (@id char(1),@Direction char(1))

    As

    SET NOCOUNT ON

    DECLARE @sort int, @id2 char(1)

    SELECT @sort = sort

    FROM testsort

    WHERE id = @id

    IF @direction...

  • RE: GROUPING based on another group ?

    try this

    SELECT T3.Year,T3.CourseID,ISNULL(T4.NumOldStudent,0) As NumOldStudent

    FROM TCourseTaken T3

    LEFT OUTER JOIN

    (

    SELECT T1.Year,T1.CourseId,Count(*) As NumOldStudent

    FROM TCourseTaken As T1

    INNER JOIN TCourseTaken As T2 ON

    (T1.Year - 1) = (T2.Year) AND

    T1.CourseId = T2.CourseID...

  • RE: Invalid column

    SELECT *, TEMPCOL=Identity(int,1,1)

    INTO #TempTable

    FROM TableX

    select * from #temptable

    where TEMPCOL =2

    drop table TableX

    drop table #temptable

  • RE: Temp Table and Global Temp Table

    Where the Local Temp table and Global Temp Table will be stored?

    Tempdb

    Is it possible to get the temp. tables scripts?

    This should check for existance of the tables if...

  • RE: Incrementing a substring

    does ISNUMERIC work for you???

  • RE: Create a file from SQL Statement

    look up osql or bcp in Books online

  • RE: Lookup Table

    I will agree with Melanie , other than making RI difficult to maintain , i think it would have some sort of performance impact

    a) this table will be heavily used...

  • RE: Are these two sql statements the same (northwind)?

    Yes they are the same,there would be no difference in execution of both..

    i personally prefer to put my constants in the where clause , but that would have no difference...

  • RE: Dynamic Order By problem

    all the fields will have to be the same type for this to work..

    a workaround would be the following query

    Set @vOrder = 1

    Select ClientID, PrimaryFirstName, PrimarySurname

    From Client

    Order By

    CASE When...

  • RE: Help: Ways of persisting the resultset from SP?

    try replacing <master> with whatever database that has sp_name...

    'SET FMTONLY OFF EXEC MyDatabase..sp_sproc_columns spname'

  • RE: Best way to run a query, need help.

    depends on what you want to do.. if you could paste the DDL and some data - we can have a look

  • RE: Help: Ways of persisting the resultset from SP?

    Hi , this should return the recordset not just columns

  • RE: Wierd Stored Procedure problem

    try updating the index statistics on the tables used in the procedure - check the query plan using SET SHOWPLAN options .. if all else fails try running the procedure...

Viewing 15 posts - 1 through 15 (of 154 total)