Forum Replies Created

Viewing 15 posts - 4,366 through 4,380 (of 10,144 total)

  • RE: Join of 2 subqueries

    daniness (7/17/2013)


    Hi Hanshi,

    Actually, originally the group by was part of the 1st subquery, but it wasn't working, so this is why I tried placing it at the end, but obviously...

  • RE: parsing data in the middle of a field??

    Not really. Like this:

    CREATE TABLE #SAMPLE (MyString VARCHAR(200))

    INSERT INTO #SAMPLE (MyString)

    SELECT 'A whole string from my table' UNION ALL

    SELECT 'A second whole string from my table' UNION ALL

    SELECT 'A third...

  • RE: any way this can avoid of index scan?

    sqlnes (7/17/2013)


    2 index scans are unavoidable?

    That's correct. You can have an index scan too if you want - just up the ratio of looked-up rows to parent rows, but you're...

  • RE: Join of 2 subqueries

    You won't get the two queries to JOIN in the way that you are attempting to, unless each query works in isolation. The second query has aggregate functions but there's...

  • RE: parsing data in the middle of a field??

    Can you post a dozen or so sample strings please Joe? Cheers.

  • RE: any way this can avoid of index scan?

    sqlnes (7/17/2013)


    Thank you Gail & Chris for explain.

    Just checked my tables and the "col1" on both table are non null. So it seems it's unavoidable.

    What's unavoidable? (Apart from D...

  • RE: any way this can avoid of index scan?

    sqlnes (7/17/2013)


    Hi, it looks impossible to me, but, is anyone know could this kind of query avoid of index scan?

    select * from A where col1 not in (select col1 from...

  • RE: Deadlock

    HanShi (7/17/2013)


    Could you rewrite the delete statement to:

    DELETE TOP (20) FROM [dbo].[ServerParametersInstance]

    WHERE Expiration < @now

    This will prevent the query to simultaneously read and delete from the same table.

    SQL Server...

  • RE: Issue with DATEDIFF returning Negative Values

    APPLY simplifies this query nicely;

    SELECT

    b.VINTAGE,

    x.DaysDiff,

    b.CR_SCR_BAND,

    x.ME_DQ,

    count(a.account),

    [BALANCE] = sum(a.currtotalbal-a.CurrDisc)

    FROM dbo.ME_MASTER a

    LEFT JOIN #temp b

    on a.ACCOUNT = b.ACCOUNT

    CROSS APPLY (

    SELECT

    [ME_DQ] = CASE

    when a.DAYSPD <...

  • RE: delete rows

    riya_dave (7/16/2013)


    hi

    i need to move data to another table and then remove from old one ,which i needs to delete 30 millions of rows,

    i know its taking time but any...

  • RE: Truncating data on a remote Server

    @Erin, yes, and it's not limited to a single statement. One such pass-thru command in the system I'm currently working on contains several INSERT and UPDATE statements protected by a...

  • RE: Truncating data on a remote Server

    You might get some mileage out of this:

    DECLARE @SQLTruncate VARCHAR(200)

    SET @SQLTruncate = 'TRUNCATE TABLE ' + @schema + '.' + @tablename

    EXECUTE(@SQLTruncate) AT LinkedServerName -- no quotes around linkedservername

  • RE: Scan count vs logical reads

    SQL Show (7/16/2013)


    So I shall go ahead with 2nd plan? Should I consider the cpu time (more than first one) as well? I am testing it in Dev , have...

  • RE: insert or update according the field value

    -- "upsert"

    UPDATE GNL_OgretmenDevamsizlikGirisLog SET

    recordtime = CASE WHEN recordtime IS NULL THEN @Newtime ELSE recordtime END,

    updatedtime = CASE WHEN recordtime IS NULL THEN updatedtime ELSE @Newtime END

    WHERE OgretmenID = @ogretmenID

    AND DersYiliID...

  • RE: NC Index Seek 51% and select cost 0%?

    Change the order of the keys - this should give you seeks on [status];

    CREATE NONCLUSTERED INDEX [IX_VIEW_IP21] ON [dbo].[RESULT]

    (

    [STATUS] ASC,

    [SAMPLE_NUMBER] ASC,

    [ANALYSIS] ASC

    )

    INCLUDE ( [UNITS],

    [NAME],

    [NUMERIC_ENTRY]) WITH (PAD_INDEX = OFF,...

Viewing 15 posts - 4,366 through 4,380 (of 10,144 total)