Ask a Question related to ASP Database, Design and Development.
-
Vilmar Brazăo de Oliveira #1
How insert null in numerics fields?
Good morning,
How insert null in numerics fields?
I can't insert 0()zero and nor other number, because any positive number can
be a possible code to my system.
I tried FieldX = Null, but I could not get sucess executing SQL.
thanks,
--
««««««««»»»»»»»»»»»»»»
Vlmar Brazăo de Oliveira
Desenvolvimento Web
HI-TEC
Vilmar Brazăo de Oliveira Guest
-
and null fields in a datagrid
in the itemDatabound event of a datagrid, both null fields and blank string come through as in the e.items.cells field. Is there anyway to... -
INSERT Null value problem
Ive got a form that posts to an Access db and a few of the fields are of "number" type in the database. These fields do not require data to... -
ASP SQL Insert NULL Date Value
Hello, I've been pulling my hair out trying to figure this out. Thank you in advance for taking the time to look at this. I'm trying to... -
#26351 [Opn->Bgs]: Incorrect handling of Null Fields/Numerical Fields with '0'
ID: 26351 Updated by: iliaa@php.net Reported By: jabberwocky at ibplanet dot com -Status: Open +Status: ... -
#26351 [NEW]: Incorrect handling of Null Fields/Numerical Fields with '0'
From: jabberwocky at ibplanet dot com Operating system: Any PHP version: 4.3.4 PHP Bug Type: MSSQL related Bug description: ... -
Bob Barrows #2
Re: How insert null in numerics fields?
Vilmar Brazăo de Oliveira wrote:
It always helps to tell us what kind of database you are using.> Good morning,
> How insert null in numerics fields?
> I can't insert 0()zero and nor other number, because any positive
> number can be a possible code to my system.
> I tried FieldX = Null, but I could not get sucess executing SQL.
>
> thanks,
Does the field/column accept Nulls, i.e., is it a Required field?
If it accepts Nulls, then usually you can simply exclude the field from the
columns list in the Insert clause in the SQL statement.
Altenatively, you can simply do this by using the Null keyword ... oh! I see
you have tried this. What happens when you do it? Error messages? If so,
what error message? Show us the code you tried
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Bob Barrows Guest
-
Vilmar Brazăo de Oliveira #3
Re: How insert null in numerics fields?
hi,
my database is sql server 2000.
field:
1 AgCodEmpresa float 8 1(it accepts null)
instruction sql:
SQLNotificacao = "Insert into
Agenda_Condominios(AgDtHora,AgSeq,AgEmpresa,AgBloc o,AgApto,AgDepartamento,Ag
Descricao,AgSolucionado,Ag3Dias,Ag2Dias,Ag1Dia,AgE mail,AgEmailsCopia,AgCodEm
presa,AgNome,AgCodCliente) values ('" _
& AgDtHora & "'," & AgSeq & "," & AgEmpresa & ",'" & AgBloco & "','" &
AgApto & "'," & AgDepartamento & ",'" & AgDescricao & "','" & AgSolucionado
& "','" & Ag3Dias & "','" & Ag2Dias & "','" & Ag1Dia & "','" & AgEmail _
& "','" & AgEmailsCopia & "'," & AgCodEmpresa & ",'" & AgNome & "'," &
Session("SiCod") & ")"
I wouldn´t like to use an conditional IF to check if I have to put the
numbers fields in select or not.
thanks your hope,
--
««««««««»»»»»»»»»»»»»»
Vlmar Brazăo de Oliveira
Desenvolvimento Web
HI-TEC
"Bob Barrows" <reb01501@NOyahoo.SPAMcom> escreveu na mensagem
news:#drqGxe1DHA.3824@TK2MSFTNGP11.phx.gbl...the> Vilmar Brazăo de Oliveira wrote:>> > Good morning,
> > How insert null in numerics fields?
> > I can't insert 0()zero and nor other number, because any positive
> > number can be a possible code to my system.
> > I tried FieldX = Null, but I could not get sucess executing SQL.
> >
> > thanks,
> It always helps to tell us what kind of database you are using.
>
> Does the field/column accept Nulls, i.e., is it a Required field?
>
> If it accepts Nulls, then usually you can simply exclude the field fromsee> columns list in the Insert clause in the SQL statement.
> Altenatively, you can simply do this by using the Null keyword ... oh! I> you have tried this. What happens when you do it? Error messages? If so,
> what error message? Show us the code you tried
>
>
> Bob Barrows
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>
Vilmar Brazăo de Oliveira Guest
-
Bob Barrows #4
Re: How insert null in numerics fields?
Vilmar Brazăo de Oliveira wrote:
Agenda_Condominios(AgDtHora,AgSeq,AgEmpresa,AgBloc o,AgApto,AgDepartamento,Ag> hi,
> my database is sql server 2000.
> field:
> 1 AgCodEmpresa float 8 1(it accepts null)
> instruction sql:
> SQLNotificacao = "Insert into
>Descricao,AgSolucionado,Ag3Dias,Ag2Dias,Ag1Dia,AgE mail,AgEmailsCopia,AgCodEm>What does Response.Write SQLNotificacao show?> presa,AgNome,AgCodCliente) values ('" _
> & AgDtHora & "'," & AgSeq & "," & AgEmpresa & ",'" & AgBloco &
> "','" & AgApto & "'," & AgDepartamento & ",'" & AgDescricao & "','" &
> AgSolucionado & "','" & Ag3Dias & "','" & Ag2Dias & "','" & Ag1Dia &
> "','" & AgEmail _ & "','" & AgEmailsCopia & "'," & AgCodEmpresa &
> ",'" & AgNome & "'," & Session("SiCod") & ")"
>
> I wouldn´t like to use an conditional IF to check if I have to put
> the numbers fields in select or not.
Have you tried this:
If len(AgCodEmpresa) = 0 then AgCodEmpresa = "Null"
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Bob Barrows Guest
-
Mark Schupp #5
Re: How insert null in numerics fields?
use a function to format your values:
Function SQLFloat( nIn )
SQLFloat= "null"
If Not IsNull( nIn ) Then
If IsNumeric(nIn) Then
SQLFloat = CStr(nIn) ' might want to use FormatNumber here
End If
End If
End Function
Then build your SQL with the function
....
"','" & AgEmail _ & "','" & AgEmailsCopia & "'," & SQLFloat(AgCodEmpresa)
&
....
--
Mark Schupp
Head of Development
Integrity eLearning
[url]www.ielearning.com[/url]
"Bob Barrows" <reb01501@NOyahoo.SPAMcom> wrote in message
news:eVUf1Bf1DHA.2528@TK2MSFTNGP10.phx.gbl...Agenda_Condominios(AgDtHora,AgSeq,AgEmpresa,AgBloc o,AgApto,AgDepartamento,Ag> Vilmar Brazăo de Oliveira wrote:>> > hi,
> > my database is sql server 2000.
> > field:
> > 1 AgCodEmpresa float 8 1(it accepts null)
> > instruction sql:
> > SQLNotificacao = "Insert into
> >Descricao,AgSolucionado,Ag3Dias,Ag2Dias,Ag1Dia,AgE mail,AgEmailsCopia,AgCodEm>> >>> > presa,AgNome,AgCodCliente) values ('" _
> > & AgDtHora & "'," & AgSeq & "," & AgEmpresa & ",'" & AgBloco &
> > "','" & AgApto & "'," & AgDepartamento & ",'" & AgDescricao & "','" &
> > AgSolucionado & "','" & Ag3Dias & "','" & Ag2Dias & "','" & Ag1Dia &
> > "','" & AgEmail _ & "','" & AgEmailsCopia & "'," & AgCodEmpresa &
> > ",'" & AgNome & "'," & Session("SiCod") & ")"
> >
> > I wouldn´t like to use an conditional IF to check if I have to put
> > the numbers fields in select or not.
> What does Response.Write SQLNotificacao show?
>
> Have you tried this:
> If len(AgCodEmpresa) = 0 then AgCodEmpresa = "Null"
>
> Bob Barrows
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>
Mark Schupp Guest
-
Vilmar Brazăo de Oliveira #6
Re: How insert null in numerics fields?
HI Bob and every body else,
this kind of things runs marvellous OK!
If len(AgCodEmpresa) = 0 then AgCodEmpresa = "Null"
OR
If AgCodEmpresa = "" then AgCodEmpresa = "Null"
I had forgot the ""(quotation marks)!!
thanks,
--
««««««««»»»»»»»»»»»»»»
Vlmar Brazăo de Oliveira
Desenvolvimento Web
HI-TEC
"Bob Barrows" <reb01501@NOyahoo.SPAMcom> escreveu na mensagem
news:eVUf1Bf1DHA.2528@TK2MSFTNGP10.phx.gbl...Agenda_Condominios(AgDtHora,AgSeq,AgEmpresa,AgBloc o,AgApto,AgDepartamento,Ag> Vilmar Brazăo de Oliveira wrote:>> > hi,
> > my database is sql server 2000.
> > field:
> > 1 AgCodEmpresa float 8 1(it accepts null)
> > instruction sql:
> > SQLNotificacao = "Insert into
> >Descricao,AgSolucionado,Ag3Dias,Ag2Dias,Ag1Dia,AgE mail,AgEmailsCopia,AgCodEm>> >>> > presa,AgNome,AgCodCliente) values ('" _
> > & AgDtHora & "'," & AgSeq & "," & AgEmpresa & ",'" & AgBloco &
> > "','" & AgApto & "'," & AgDepartamento & ",'" & AgDescricao & "','" &
> > AgSolucionado & "','" & Ag3Dias & "','" & Ag2Dias & "','" & Ag1Dia &
> > "','" & AgEmail _ & "','" & AgEmailsCopia & "'," & AgCodEmpresa &
> > ",'" & AgNome & "'," & Session("SiCod") & ")"
> >
> > I wouldn´t like to use an conditional IF to check if I have to put
> > the numbers fields in select or not.
> What does Response.Write SQLNotificacao show?
>
> Have you tried this:
> If len(AgCodEmpresa) = 0 then AgCodEmpresa = "Null"
>
> Bob Barrows
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>
Vilmar Brazăo de Oliveira Guest



Reply With Quote

