Inserting into a text field in SQL Server 2000

  • Hi - my problem is as follows:  I'm writing an ASP.Net 2.0 app with C#.  From the app, I call a stored procedure that updates some data in the app's database (SQL Server 2000).  This stored procedure then declares and assigns a value to a variable of type nvarchar(4000) and calls a 2nd stored procedure, passing it, among other things, the newly created variable.  The 2nd stored procedure performs some updates to a different SQL Server 2000 database, one which comes with a 3rd party app we're using.  The variable that's passed to the 2nd stored procedure is supposed to be inserted into a text field in a table in the 3rd party database.  If I run the stored procedure(s) from Query Analyzer, there's no problem.  When the sp's run from my .Net app, though, the text field doesn't get inserted if it's longer than about 90 characters.  This happens whether I try to perform the insert with an INSERT, a WRITETEXT or an UPDATETEXT statement.  The INSERT statement isn't failing because it inserts more than this one variable; it succesfully creates a new record and inserts various other variable values into various other fields (not of type text).  But the text field in the new record always shows blank if it's over 90 characters long.  Since the variable is created in the 1st sp, I don't think this is a problem with my .Net app (which, according to the debugger, is passing the 1st sp's parameters correctly), but I'm wondering if there may be a SQL setting that's different between the .Net framework and what's native to Query Analyzer.  I've set TEXTSIZE to 2GB in both sp's, with no difference in result.  Are there any other settings that could affect how much text can be put into a text field?  Also, is there a way I can step through these sp's as they run to see what the sp's think this variable value is as it's running?  I'm stumped.

    Thanks!

  • Can we see the code of those sps please.

     

    TIA.

  • might be you can use trigger.

  • One method I use occansionally is to create a log table, then insert values into that table at certain points in my code. After a run, you can peruse the log table.

    CREATE TABLE spLog

    (

      id int IDENTITY(1,1)

    , logDate datetime DEFAULT GetDate()

    , userid varchar(30) DEFAULT SUser_SName()

    , message varchar(200) NULL

    )

    GO

    --In your SP, place lines like these to verify the length of the text parameter

    INSERT spLog (message) SELECT 'Text Length=' + Convert(varchar(10), Len(@textVar))

    -- After the INSERT or UPDATE operation, examine the log

    SELECT * FROM spLog

     

  • Good idea!!  Thanks!

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply