Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

SQLITE fields

  • 14-09-2011 11:45am
    #1
    Registered Users, Registered Users 2 Posts: 91 ✭✭


    If a tables 'name' field is the same as one of the tables 'field' in SQLITE should there be any duplication/problems etc??

    I have a table named sb_Market.
    One of this tables name is called 'Handicap'
    One of the fields' is also called 'Handicap' with a value.

    When I make any changes within the 'Handicap' , the name changes to the field value.


Comments

  • Registered Users, Registered Users 2 Posts: 2,021 ✭✭✭ChRoMe


    keithrus wrote: »
    If a tables 'name' field is the same as one of the tables 'field' in SQLITE should there be any duplication/problems etc??

    I have a table named sb_Market.
    One of this tables name is called 'Handicap'
    One of the fields' is also called 'Handicap' with a value.

    When I make any changes within the 'Handicap' , the name changes to the field value.

    It should be fine, can you post what query you are using?


  • Registered Users, Registered Users 2 Posts: 11,989 ✭✭✭✭Giblet


    Are you able to use the fully qualified name? dbname.tablename.column ?


  • Registered Users, Registered Users 2 Posts: 91 ✭✭keithrus


    SELECT * FROM sb_Market WHERE sb_Market.MeetngId=19798 AND sb_Market.EventId=2 AND sb_Market.Name='Handicap';


  • Registered Users, Registered Users 2 Posts: 1,456 ✭✭✭FSL


    Do you not need [] around Name as Name is an attribute and you are also using it as a field name e.g sb_Market.[Name]='Handicap'.

    This is the case in MSSQL.


  • Registered Users, Registered Users 2 Posts: 2,781 ✭✭✭amen


    more fundamental why do you have a table and column with the same name?

    Would the table handicap be better named as playerhandicap, personhandicap etc?


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 91 ✭✭keithrus


    Resolve found.

    Its how SQLITE handles and recognises double and single quotes on an update.

    Apparently, this is done on an update to the DB
    UPDATE sb_Market SET Name=”Handicap” WHERE...

    This works fine, unless there happens to be a field in the table called “Handicap”, in which case the value of this field rather than the text “Handicap” are inserted.

    The correct update statement should look like this:



    UPDATE sb_Market SET Name=’Handicap’ WHERE...


Advertisement