Forum Replies Created

Viewing 15 posts - 376 through 390 (of 5,504 total)

  • RE: tsql for XML format the values as elements

    I don't understand why values of a column would need to be translated into tag (or element) names without any text value, especially if the values contain invalid character for...

  • RE: need NULL defined when adding to the table

    If you need to update the table, then the question is: what rules do apply?

    The table is already defined as requested ("IsValidSap (should have null defined when adding to the...

  • RE: tsql for XML format the values as elements

    I'm not sure why those character wouldn't be properly displayed.

    I tried

    select NAME as a from @XMLTest for XML PATH('')

    and received

    <a>One¬d¦Uº</a>

    <a>Two</a>

    <a>Three</a>

    So I don't think there's any need to replace...

  • RE: tsql for XML format the values as elements

    duplicate post. No replies please. Replies to

  • RE: Is TRY-CATCH in SQL still a best practice?

    Well, your DBA is absolutely right "that it (a TRY-CATCH block) is a very inefficient way of creating a transaction". 🙂

    I also agree, that it therefore should not be...

  • RE: Multiple logins to single DB group

    I'm not sure if I follow you completely.

    By referring to "700+ corresponding database users" do you mean DomainA\Agents, DomainB\Agents and 698 more "users" (= domain groups)?

    If so, I'd say there's...

  • RE: Join in two tables

    ankit.gupta1 (10/15/2013)


    The problem with cross tab or pivot method is that we have to hard-code total number of columns.

    Here in the table t2 there may be any number of rows...

  • RE: sorting by month with current month at top

    J Livingston SQL (10/14/2013)


    bit late......

    SELECT DATEPART(mm, OrderDate) AS MonthNum, AVG(orderCount) AS AvgOrderCount

    FROM OrderTest

    GROUP BY DATEPART(mm, OrderDate), DATEADD(mm, DATEDIFF(mm, 0, OrderDate), 0)

    ORDER BY DATEADD(mm,...

  • RE: Join in two tables

    You might want to look into PIVOT (or CrossTab, as referenced in the related link in my signature).

  • RE: sorting by month with current month at top

    Yep, you're correct.

    That's one of the pitfalls when not seeing the complete date - I totally missed the sort order. Sorry.

  • RE: sorting by month with current month at top

    Something like this (I used a cte to get a sort criteria added to the group by statement that is omitted in the final output)?

    WITH cte as

    (

    SELECT datepart(mm,OrderDate) MonthNum,AVG(orderCount) AvgOrderCount,...

  • RE: Preventing All Updates and Deletes

    ScottPletcher (10/14/2013)


    ...You would have to use a trigger to prevent sa activity....

    Every sa could disable the trigger and still perform updates.

    Whatever concept is applied, a system admin can change it...

  • RE: sorting by month with current month at top

    What is your expected output if we'd add another row like INSERT INTO OrderTest VALUES('2011/11/17',11) ?

    Your current query only aggregate by month, so the above value will be added to...

  • RE: Need a Query on group by condition

    Here's a cte based solution.

    But, as already mentioned, this query is everything but efficient and clean code.

    From my point of view there are three options:

    a) get the MONTHY column into...

  • RE: select problem 3 table

    Your sample data and your expected output don't seem to match please clarify

    a) Why not my phone 1 1 1 and my phone 1 1 1?

    b) Why isn't "your"...

Viewing 15 posts - 376 through 390 (of 5,504 total)