Cannot Get Field Nullable Property

Discussion in 'ASP General' started by Paul Eaton, Jul 14, 2003.

  1. Paul Eaton

    Paul Eaton Guest

    Hi

    I am using asp/vbscript/ado/mssql.

    I am able to get the nullable property OK when generating a recordset
    with a simple SQL statement such as "select Fld1,Fld2 from Table1" and
    then looping thro' the fields and :-

    Response.Write(rs.fields(x).attributes and adFldIsNullable)

    When I use the following statement all fields are erroneously reported
    as nullable:-

    "Select B.Fld2, B.Fld3 From Table1 A Left Join Table2 B On
    A.Fld1=B.Fld1"

    Is this normal?
    Paul Eaton, Jul 14, 2003
    #1
    1. Advertising

  2. Paul Eaton

    Bob Barrows Guest

    This recordset may not even be updatable, and you're worried about whether
    or not the fields are nullable?

    If you set the Unique Table dynamic property, you may get the true results
    for the fields. You can only set this property if you use a client-side
    cursor (adUseClient). I have no idea if this will work. I've never tried to
    update a recordset whose source was a multi-table select statement.

    Bob Barrows

    Paul Eaton wrote:
    > Hi
    >
    > I am using asp/vbscript/ado/mssql.
    >
    > I am able to get the nullable property OK when generating a recordset
    > with a simple SQL statement such as "select Fld1,Fld2 from Table1" and
    > then looping thro' the fields and :-
    >
    > Response.Write(rs.fields(x).attributes and adFldIsNullable)
    >
    > When I use the following statement all fields are erroneously reported
    > as nullable:-
    >
    > "Select B.Fld2, B.Fld3 From Table1 A Left Join Table2 B On
    > A.Fld1=B.Fld1"
    >
    > Is this normal?
    Bob Barrows, Jul 14, 2003
    #2
    1. Advertising

  3. Do you need to get the *data* in order to get the metadata? How about
    grabbing the column names and whether they are NULL or not from the I_S
    view:

    sql = "SELECT COLUMN_NAME, IS_NULLABLE " & _
    " FROM INFORMATION_SCHEMA.COLUMNS " & _
    " WHERE TABLE_NAME='Table1'"
    set rs = conn.execute(sql)
    do while not rs.eof
    response.write rs(0) & " nullable? " & rs(1) & "<br>"
    rs.movenext
    loop





    "Paul Eaton" <> wrote in message
    news:...
    > Hi
    >
    > I am using asp/vbscript/ado/mssql.
    >
    > I am able to get the nullable property OK when generating a recordset
    > with a simple SQL statement such as "select Fld1,Fld2 from Table1" and
    > then looping thro' the fields and :-
    >
    > Response.Write(rs.fields(x).attributes and adFldIsNullable)
    >
    > When I use the following statement all fields are erroneously reported
    > as nullable:-
    >
    > "Select B.Fld2, B.Fld3 From Table1 A Left Join Table2 B On
    > A.Fld1=B.Fld1"
    >
    > Is this normal?
    Aaron Bertrand - MVP, Jul 14, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. buran

    nullable sqlparameter

    buran, Jul 17, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    497
    buran
    Jul 17, 2003
  2. Jacques Wentworth

    Property 'Keycode' is non-nullable

    Jacques Wentworth, Mar 11, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    3,600
    Jacques Wentworth
    Mar 11, 2005
  3. Benton
    Replies:
    2
    Views:
    546
    Benton
    Apr 18, 2007
  4. Rafa³ Ziêba

    Nullable property in property grid

    Rafa³ Ziêba, Jul 3, 2008, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    763
    Rafa³ Ziêba
    Jul 3, 2008
  5. Sound
    Replies:
    2
    Views:
    430
    Randy Webb
    Sep 28, 2006
Loading...

Share This Page