Forum Replies Created

Viewing 15 posts - 3,826 through 3,840 (of 3,957 total)

  • RE: Blocking Issue

    EKF is 100% correct - this should be a single update with no loop.

    Try rewriting it that way to see if your execution time problem goes away.

    If you're not sure...

  • RE: Pivot Like Report for Excel

    Phil,

    Actually I need to thank you as well. As it turns out, I happen to be developing a course on SQL at this moment and this particular problem illustrates...

  • RE: Query Help

    I posted a solution on a similar topic quite recently here:

    http://www.sqlservercentral.com/Forums/Topic1273926-392-2.aspx

    Perhaps this will help you, perhaps not. Depends on your incoming data format and exactly how you need your...

  • RE: Identity column Problem

    Think about it, you are explicitly using an order by. This is how the dynamic tally table works.

    Yes I know. But then why does removing the INNER JOIN cause...

  • RE: Pivot Like Report for Excel

    Thanks for posting some reasonably consumable DDL!

    Try this:

    --Essential Project Columns

    DECLARE @Projects TABLE(

    [Project] [VARCHAR](255) NULL,

    [Owner] [VARCHAR](36) NULL,

    [Sponsor] [VARCHAR](36) NULL,

    [StartDate] [DATETIME] NULL,

    [DueDate] [DATETIME] NULL,

    [Resources] [VARCHAR](255) NULL

    )

    --Generic Data (Multiple Resources delimited with...

  • RE: Identity column Problem

    Lynn,

    To ensure order you need an ORDER BY clause.

    How about this case?

    DECLARE @n TABLE (n INT)

    INSERT @n (n)

    SELECT 5

    UNION ALL SELECT 1

    UNION ALL SELECT 4

    UNION ALL SELECT 2

    UNION ALL SELECT...

  • RE: BETWEEN ages

    -- Also works

    if @minage > @maxage set @minage = @maxage + @minage

    if @minage > @maxage set @maxage = @minage - @maxage

    if @minage > @maxage set @minage = @minage -...

  • RE: BETWEEN ages

    -- Won't work

    if @minage > @maxage set @minage = @maxage

    if @minage > @maxage set @maxage = @minage

    -- Will work

    if @minage > @maxage select @minage = @maxage, @maxage = @minage

  • RE: Vertical to Horizontal

    Mr. Cadavre,

    You may want to try these two against each other. I think the CROSS APPLY is faster:

    SET STATISTICS TIME ON

    SET STATISTICS IO ON

    IF OBJECT_ID('TempDB..#Temp') IS NOT NULL

    DROP TABLE...

  • RE: clubbing a group of column values orderwise

    Mine is not to question why, only to do it without CURSORs:

    DECLARE @u TABLE (type VARCHAR(25), VARCHAR(10), email VARCHAR(100))

    INSERT INTO @u (type, , email)

    SELECT 'Administrator','a','a@abc.com'

    UNION ALL SELECT 'Administrator','b','b@abc.com'

    UNION ALL...

  • RE: Grouping by month with null months

    Either of the following will return the results you want. The second is the way I would do it and it has a much better execution plan cost.

    ;with calendar...

  • RE: Listing customers who are not taking advantage of projects

    I am not sure why Cadavre's solution returns this record, because I don't think there's record in Data for Customer C and ProjA:

    ProjA CustomerC...

  • RE: how to delete all except results of select statement

    Is something like this what you mean to do (try it in a Test database :-))?

    delete g

    FROM gwinn_hw g

    LEFT OUTER JOIN (

    select ptid, pat_ext_id, pat_last_name, pat_first_name, gwn_practice_id, kis_practice_id

    , Max(d_vital) as...

  • RE: PIVOTING on more than One Col. to get data in given format.

    I had to fix some of the column names in your CREATE TABLE to match the columns referenced on the INSERTs and this may not do it the way you...

  • RE: Help on inserting into multiple table with distinct columns simultaneously

    I am not sure this will solve your problem because if @userid is NULL it can only mean you're not getting a match when you query it out of your...

Viewing 15 posts - 3,826 through 3,840 (of 3,957 total)