Forum Replies Created

Viewing 15 posts - 691 through 705 (of 897 total)

  • RE: Query doubt

    Please provide us some sample data to work with and the expected result. Post the same in a ready to use format so that people can give you a tested...

  • RE: Help on Table/Query tuning

    If you are fetching all the records, then the Indexes will not be used and hence adding an Index will not make a difference.

  • RE: Removing duplicates

    You can use ROW_NUMBER() for the same

    SELECT *

    FROM(

    SELECT ROW_NUMBER() OVER ( PARTITION BY dataId, code, imageName ORDER BY loadId...

  • RE: possibility with Group By Function

    If i am understanding your requirement correctly you want to keep the GROUP BY Clause Dynamic. For this you can use a Dynamic Query like given below

    DECLARE@strGroupByClause VARCHAR(1000)

    DECLARE@strSQL VARCHAR(8000)

    SET@strGroupByClause =...

  • RE: Regarding the sql

    This is too trivial to help you out with the actual code. Is this a home work question? Have a look at the SUM() function in Books Online. Get back...

  • RE: Updating a table starting with the first empty column in a specific row

    See if this helps

    ; WITH cte_FALSEDESCRIPTION AS

    (

    SELECTROW_NUMBER() OVER( ORDER BY RequestID ) RowNum, *

    FROMFALSEDESCRIPTION

    WHERERequestID = ''

    )

    UPDATEcte_FALSEDESCRIPTION

    SETRequestID = RowNum

    Not tested as you did not provide the sample data to test with.

  • RE: Problem using the table variable of a function in a query

    Try changing it with a sub query like this

    SELECTweekdate,

    case when version_id = LV.Version then 1 else 0 end as LatestVersion

    FROM(

    select MIN(DATEADD(wk,datediff(wk,0,timeuploaded),0))as weekdate

    from telemetry

    group by DATEPART(WW,timeUploaded), DATEPART(yy,timeUploaded)

    ) T

    CROSS APPLYdbo.[GetLatestVersion] (...

  • RE: Problem using the table variable of a function in a query

    I think you are looking for a CROSS APPLY

    select MIN(DATEADD(wk,datediff(wk,0,timeuploaded),0))as weekdate,

    SUM(case when version_id = LV.Version -- Changed here

    then 1 else 0 end) as LatestVersion (If this xondition is not true...

  • RE: Exists Update Issue

    sc-w (7/30/2010)


    Sorry, i copied the wrong query, this is the update query.

    UPDATE wce_contact

    SET user1 = 'prospect Bath'

    WHERE EXISTS

    (SELECT h.NOTES, c.user1

    FROM ...

  • RE: Exists Update Issue

    Please post the UPDATE query that you are using. I can see only 2 SELECT queries.

    And one more thing, there is no use of the LEFT OUTER JOIN. The Where...

  • RE: Joining two tables need all records from both periods regardless which one has more.

    Your Table Structures are not that clear. Please have a look at the link in my signature on How to post questions to get faster answers.

    Anyways, I think what you...

  • RE: top 5th to 10 th record of a table

    malleswarareddy_m (7/22/2010)


    I know that but some one of friend told that its take more time to execute.that why i posted if there is another way which executing faster than using...

  • RE: top 5th to 10 th record of a table

    Since you know that this can be done using ROW_NUMBER(), try some code yourself and if you are stuck, then come back with proper test data and the script with...

  • RE: Unable to change a column from DATETIME to INT

    Grant Fritchey (7/22/2010)


    There is no implicit conversion from DATETIME to INT. If your table has no data, drop it and recreate it. Otherwise, what you need to do is create...

  • RE: using CASE in WHERE clause

    You still haven't got clearly what Paul explained. The Where Clause is not evaluated for the whole table at one go, It is evaluated on a row by row basis....

Viewing 15 posts - 691 through 705 (of 897 total)