Forum Replies Created

Viewing 15 posts - 4,501 through 4,515 (of 5,393 total)

  • RE: Anyone know how to obtain the SQL code which caused a trigger to fire?

    This is the piece of code I use in my triggers:

    DECLARE @SQLBuffer nvarchar(4000)

    DECLARE @buffer TABLE (

    EventType nvarchar(30),

    Parameters int,

    EventInfo nvarchar(4000)

    )

    INSERT @buffer

    EXEC sp_executesql N'DBCC INPUTBUFFER(@@spid) WITH NO_INFOMSGS'

    SELECT @SQLBuffer = EventInfo

    FROM @buffer

    -- Gianluca Sartori

  • RE: Anyone know how to obtain the SQL code which caused a trigger to fire?

    DBCC INPUTBUFFER(@@SPID) is the only way I have found so far to do this.

    All queries involving DMVs did return the trigger code or the calling stored procedure code. I...

    -- Gianluca Sartori

  • RE: Counting results

    No, no other ideas without table scripts, sample data and desired output. It's a shot in the dark this way.

    Please see the article in my signature.

    Once you provided more info,...

    -- Gianluca Sartori

  • RE: Cross tab and Moving running totals

    You may find a technique to achieve this in Jeff Moden's article on running totals:

    http://www.sqlservercentral.com/articles/T-SQL/68467/

    Hope this helps

    -- Gianluca Sartori

  • RE: tuning the query which is having cursors

    I don't think you will get any useful replies this way. Many things are missing.

    You're not saying which tables are involved and what they look like, and, first of all,...

    -- Gianluca Sartori

  • RE: Counting results

    Try using LEFT join instead of INNER JOIN, assigning a predetermined value to NULL answers (-1 in my example):

    SELECT dbo.tbl_Results.User_ID,

    dbo.tbl_Questions.Answer AS...

    -- Gianluca Sartori

  • RE: All Updates not updating table in sp

    It's impossibile to answer this question without seeing the code.

    Please post table scripts and the stored procedure code.

    If your tables have triggers defined, post their code too.

    -- Gianluca Sartori

  • RE: Counting results

    It would be very helpful to see what your tables look like.

    Anyway, without any other information, all I can tell you is something like this:

    SELECT answer, COUNT(*) AS answer_count

    FROM answers

    WHERE...

    -- Gianluca Sartori

  • RE: Ranking columns

    Sorry, I removed my reply, since I misunderstood your question.

    -- Gianluca Sartori

  • RE: The Missing Certification

    Gift Peddie (3/29/2010)


    The Napolitano is warm and friendly, the Vienezano is cultured and reserved and the Milanese is snooty and aloof.

    Have you ever been to Italy, Gift? If so, I...

    -- Gianluca Sartori

  • RE: Are the posted questions getting worse?

    GilaMonster (3/29/2010)


    Jack Corbett (3/29/2010)


    ... but the time change and amount of natural light has little to do with how well I function prior to finishing my coffee and 10am arriving.

    So...

    -- Gianluca Sartori

  • RE: Are the posted questions getting worse?

    jcrawf02 (3/26/2010)


    Paul White NZ (3/26/2010)


    Gianluca Sartori (3/26/2010)


    When I received it I saw it was shipped from Auckland, NZ!!! That's why it took so long!

    Hey! Don't go blaming Auckland! :crazy::angry:

    (joke)

    So...

    -- Gianluca Sartori

  • RE: Are the posted questions getting worse?

    Paul White NZ (3/26/2010)


    Gianluca Sartori (3/26/2010)


    When I received it I saw it was shipped from Auckland, NZ!!! That's why it took so long!

    Hey! Don't go blaming Auckland! :crazy::angry:

    (joke)

    It couldn't...

    -- Gianluca Sartori

  • RE: Are the posted questions getting worse?

    BTW, I received my copy of SQL Server MVP Deep Dives two weeks ago, but I ordered it 3 weeks earlier from Amazon.com, even if I chose the Expedited International...

    -- Gianluca Sartori

  • RE: Are the posted questions getting worse?

    BTW, I received my copy of SQL Server MVP Deep Dives two weeks ago, but I ordered it 3 weeks earlier from Amazon.com, even if I chose the Expedited International...

    -- Gianluca Sartori

Viewing 15 posts - 4,501 through 4,515 (of 5,393 total)