Forum Replies Created

Viewing 15 posts - 2,776 through 2,790 (of 10,144 total)

  • RE: help writing this subquery

    An alternative to Luis' method:

    SELECT

    e.*,

    x.Addresscode, x.AddressType, x.[Address]

    FROM #employee e

    OUTER APPLY (

    SELECT TOP 1 *

    FROM #EmpAddress a

    WHERE a.Eid = e.Eid

    ORDER BY AddressType, Addresscode

    ) x

  • RE: IF EXISTS vs @@ROWCOUNT

    IMHO the option "Neither" is correct, because MERGE is likely to outperform options 1 and 2, both of which require a test in some or all cases. Since the poster...

  • RE: Error in CASE statement

    Eirikur Eiriksson (11/26/2014)


    Quick suggestion, combine the conditionals, consider this example which does the same as your code

    😎

    SELECT

    CASE

    ...

  • RE: Are the posted questions getting worse?

    Evil Kraig F (11/24/2014)


    Jeff Moden (11/24/2014)


    Eirikur Eiriksson (11/24/2014)


    Just a quick question to "the thread", am I missing something or is XML getting more popular? Just noticed that this topic on...

  • RE: "Order" between JOIN and APPLY

    sgmunson (11/21/2014)


    Can I ask what might seem like a dumb question? Why is anyone trying so hard to write this query in such a way as to make...

  • RE: "Order" between JOIN and APPLY

    Thanks Serg, my bad:

    SELECT a.id

    ,T1.F.value('(//Node1)[1]', 'varchar(100)') x

    --,T2.F.value('(//Node2)[1]', 'varchar(100)') y

    FROM #Table1 AS a

    CROSS APPLY a.data.nodes('//Node1') AS T1(F) -- part 1

    LEFT JOIN #Table1 b

    CROSS APPLY a.data.nodes('//Node2') AS T2(F) -- part 2

    ON...

  • RE: Convert exponential Number to non-exponential numbers...

    The restrictions of the FLOAT datatype are specified here. The numbers you've posted look ok, however I'd recommend you check your data for elements which may be out of range.

  • RE: "Order" between JOIN and APPLY

    If you look again at the original query:

    ...

    FROM

    Table1 AS a

    CROSS APPLY data.nodes('.../Node1') AS T1(F) -- part 1

    LEFT JOIN Table1 AS b

    CROSS APPLY data.nodes('.../Node2') AS T2(F)...

  • RE: Convert exponential Number to non-exponential numbers...

    manifbest (11/20/2014)


    Hello All,

    I want to find out the standard deviation from the following value but it gives me error because i am using STDEV function from the MSSQL.

    My...

  • RE: "Order" between JOIN and APPLY

    sgmunson (11/19/2014)


    ChrisM@Work (11/19/2014)


    Steve - (F) is a column name assignment:

    SELECT * FROM (SELECT 1) d (ColumnName)

    Ahhh, ... ok... I try really hard NOT to use that kind of...

  • RE: "Order" between JOIN and APPLY

    Steve - (F) is a column name assignment:

    SELECT * FROM (SELECT 1) d (ColumnName)

  • RE: SQL newbie: How to extract all columns from multiple tables and save to a new table

    Ashish Dutt (11/18/2014)


    ...Is there any other way of accomplishing this task in lesser amount of query execution time?

    Please suggest. Eagerly awaiting your conducive response.

    Yes there is. You mentioned that two...

  • RE: master.mdb .trc files filling up system volume

    Stored procedures marked to run on startup:

    SELECT [name] FROM master.dbo.sysobjects WHERE type = 'P' AND OBJECTPROPERTY(id, 'ExecIsStartUp') = 1;

  • RE: Combining costs from across tables to populate temporary table

    That's horrible code. A cursor loop is much the same as a while loop, you won't gain anything by changing your existing loop into a different one. What you really...

  • RE: cte performance issue

    Complex queries run the risk of failing to obtain a satisfactory execution plan, as the optimiser doesn't have sufficient time to explore all possibilities. You'll get a plan so the...

Viewing 15 posts - 2,776 through 2,790 (of 10,144 total)