8000 character limit in ASP Classic/SQL server

Asked

Viewed 215 times

1

Dear friends,

I’m trying to update a table in SQL Server 2008 R2, but the field only records 8000 characters.

The column is set to 'text', but I have tried changing to 'varchar(max)' unsuccessfully.

I also used 'cast ('variable' as text)' and 'cast ('variable' as varchar(max))' also unsuccessfully.

Doing the same update from the SQL console or inserting more than 8000 characters manually works (by Microsoft Visual Studio).

sql_Up = "UPDATE ABVC_Eventos SET titulo_eve = '" & Strip(Evento) & "', cod_sup_eve = '" & Strip(cod_sup_eve) & "', cod_sup2_eve = '" & Strip(cod_sup2_eve) & "', texto_eve = CAST('" & Strip(texto_eve) & "' AS TEXT), WHERE id_eve = '" & Strip(Cod_Evento) & "'" 
set Rs_sqlUp = bco.Execute(sql_Up)

The 'Strip' function is for sanitization.

  • You have already given a Response.Write sql_Up and checked if the update is full text before the run?

  • Yes. I even copied and pasted the print on the console and it updated as it should.

  • Man I don’t remember in my head but I believe it is possible to define the maximum size of the commandText maybe in iis or in a config file, but I believe that is not the problem because if it would not give an error in Asp, when you did the manual update in sql the full value was stored or it was cut?

  • Manually was complete. Either running the query you showed with Response.write or typing directly into the field.

  • I couldn’t think of anything to help, if possible try to share more information like: Version of sql, target table structure the update command. So I’ll be able to simulate execution around here

  • I’ve been searching and maybe it can be solved using a parameterized query. If it works here the result. Thank you!

  • You need to use ADO Createparameter with the data type adLongVarChar. See the link: https://www.w3schools.com/asp/met_comm_createparameter.asp

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.