Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9161423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:57:49+00:00 2026-06-17T13:57:49+00:00

lets assume i have a staement variable like this: sql_ins = INSERT INTO tableName

  • 0

lets assume i have a staement variable like this:

sql_ins = "INSERT INTO tableName (field1,field2,field3) VALUES ("&var1&","&var2&","&var3&")

well, let’s say that var1, var2, var3 could be also null, and the database has default values as null.

the problem is that i could insert a NULL value, but if the variable is null it will be empty, so the sql_ins should look like:

INSERT INTO tableName (field1,field2,field3) VALUES (4,,)

how i could avoid it?

thanks in advance.

real code here:

For Each Field in Request.Form
    TheString = Field & "=Request.Form(""" _
    & Field & """)"
    EXECUTE(TheString)
Next

if imm_id <> "" then
'TODO modifica
else 
sql_ins = "INSERT INTO tb_immobile (`IdServizio`, `CodiceAppartamento`, `Nome`, `IdLocalita`, `Localita`, `NumeroPiano`, `Piano`, `NumeroScalini`, `Camere`, `Singole`, `Matrimoniali`, `Bagni`, `Vani`, `IdTipo`, `IdPosizione`, `IdAspetto`, `IdRistrutturato`, `IdAmmobiliato`, `IdStato`, `Mq`, `Annesso`, `IdAnnessoRistrutturato`, `Giardino`, `Terrazza`, `Terreno`, `Cantina`, `AriaCondizionata`, `Ascensore`, `PostiAuto`, `Piscina`, `Tennis`, `IdRiscaldamento`, `Condominio`, `idAllegato`, `idUtente`, `idImportazione`, `idZona`, `idDove`, `homePage`, `codTipoVisaulizzazione`) VALUES "
sql_ins = sql_ins&"(1,"&imm_codice&","&imm_nome&","&imm_provincia&",'"&imm_localita&"',"&imm_npiani&","&imm_piano&","&imm_scalini&","&imm_camere&","&imm_camere_sing&","&imm_camere_mat&","&imm_bagni&","&imm_vani&","&imm_tipo&","&imm_posizione&","&imm_aspetto&","&imm_ristrutturato&","&imm_ammobiliato&","&imm_stato&","&imm_mq&"...  )"


end if

in the first for each i create and populate the variables, but some of them should be empty.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T13:57:51+00:00Added an answer on June 17, 2026 at 1:57 pm
    if var1 Is Nothing then var1 = "NULL" end if
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets assume I have this long insert statement insert into table1 (id, name, phone,
Lets assume i have a query like the following $query_search = SELECT * FROM
Lets say i have a table like this: col1 col2 col3 row1 1 null
lets assume we have this table called visits and it has two fields id
Lets assume I have a bash script that executes code like so: for i
Lets assume I have several <span class='remove-type'> elements on a page. In jQuery document.ready
Lets assume I have 2 XML variables in SQL Server 2008 with the following
Lets assume I have the following 3 entities: Customer,Order,Product which interact in the View
Lets assume we have a class car. How would You name parameters of function
Lets assume we have the following code: abstract class Base1 { protected int num;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.