none
stored procedure and insert data...

    Question

  • I have this stored procedure.. but it doesn't insert data... Why???


    SET QUOTED_IDENTIFIER OFF
    GO
    SET ANSI_NULLS ON
    GO

    CREATE PROCEDURE dbo.DETTAGLIO_TURNI_DIFENSORI
    AS

    INSERT INTO Albo_Turno_Dettaglio
    (
    idalboturno,
    idalbo,
    idturno,
    data
    )
    VALUES
    (
    '885261', -- ID chiave
    '15', -- da cursore
    '778',
    '2008-04-01 00:00:00.000' -- problemi inserimento data??
    )



    GO
    SET QUOTED_IDENTIFIER OFF
    GO
    SET ANSI_NULLS ON
    GO

    Friday, February 22, 2008 9:59 AM

Answers

  • Do you get any error messages or does it execute without doing the INSERT?

     

    Are there any Triggers on the Albo_Turno_Dettaglio table?

     

    Friday, February 22, 2008 10:08 AM

All replies

  • Do you get any error messages or does it execute without doing the INSERT?

     

    Are there any Triggers on the Albo_Turno_Dettaglio table?

     

    Friday, February 22, 2008 10:08 AM
  •  LeighM wrote:

    Do you get any error messages or does it execute without doing the INSERT?

     

    Are there any Triggers on the Albo_Turno_Dettaglio table?

     




    it execute without doing the insert..
    no, there aren't triggers..






    Friday, February 22, 2008 10:19 AM
  • Some possibilities which i feel are

    -I doubt whether there are any instead of trigger in place

    -Whether any SET statements like "SET FMT ONLY" also got compiled along with, while applying the SP. If the above statement is also compiled along with, the exec will return an empty result set, as if nothing is inserted. Verify using a SQL profiler.

     

    Friday, February 22, 2008 10:23 AM
  • What info do you get back on the "Messages" tab of SSMS? e.g. "1 row(s) affected"

     

    How are you executing the Stored Procedure?

     

    Does the INSERT statement work if you run it outside of the Stored Procedure?

     

     

     

    Friday, February 22, 2008 10:28 AM
  •  LeighM wrote:

    What info do you get back on the "Messages" tab of SSMS? e.g. "1 row(s) affected"

     

    How are you executing the Stored Procedure?

     

    Does the INSERT statement work if you run it outside of the Stored Procedure?

     

     



    I'm executing the Stored Procedure in Query Analyzer Debug and I've info

    "@RETURN_VALUE = 0"



    yes, the INSERT statement work if I run it outside of the Stored Procedure..

    Friday, February 22, 2008 10:36 AM
  • You say you're running it in debug, just to confirm, does it run correctly if you run the SP from a new query window?

     

    Code Snippet

    EXEC dbo.DETTAGLIO_TURNI_DIFENSORI

     

     

     

    Friday, February 22, 2008 10:47 AM
  •  LeighM wrote:

    You say you're running it in debug, just to confirm, does it run correctly if you run the SP from a new query window?

     

    Code Snippet

    EXEC dbo.DETTAGLIO_TURNI_DIFENSORI

     

     

     



    yes it run correctly
    Friday, February 22, 2008 1:33 PM
  • Actually what hapens is that when u compile your application the database is copied to bin directory of your project (only if u r using SQLEXPRESS with Visual Studio 2005) and all the data is inserted in that database but u actual database is not modified. Then if u again compile ur project the database in bin directory is replaced by a new copy. Now by this hint I think u can manage ur application wel.
    Wednesday, March 26, 2008 4:45 AM