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

SQL table overwriting data

  • 03-07-2016 9:00pm
    #1
    Registered Users, Registered Users 2 Posts: 6,488 ✭✭✭


    Hi everyone I am a relative SQL newbie and I am updating an existing SQL database. I added a new table and my data is being stored however only on row 1 (so the data is constantly overwritten).

    Anyone know what I might be doing wrong? The table has 3 columns which are start time end time and tank name.


Comments

  • Registered Users, Registered Users 2 Posts: 561 ✭✭✭sbs2010


    kingtut wrote: »
    Hi everyone I am a relative SQL newbie and I am updating an existing SQL database. I added a new table and my data is being stored however only on row 1 (so the data is constantly overwritten).

    Anyone know what I might be doing wrong? The table has 3 columns which are start time end time and tank name.

    What is the statement you are running - the statement that you think should be inserting but you're finding is updating the single row?


  • Registered Users, Registered Users 2 Posts: 6,488 ✭✭✭kingtut


    sbs2010 wrote: »
    What is the statement you are running - the statement that you think should be inserting but you're finding is updating the single row?

    I'm sorry I don't fully understand what you mean by a statement?

    If it helps I am using Factory talk transaction manager to grab data from a PLC and then storing it in SQL.

    For example I would expect the SQL table to look like:

    Row 1: 11:00 11:30 Tank 1
    Row 2: 14:00 14:20 Tank 5

    but all I see is one row of data so based on the above example my table currently shows

    Row 1: 14:00 14:20 Tank 5


  • Registered Users, Registered Users 2 Posts: 23,093 ✭✭✭✭Esel
    Not Your Ornery Onager


    Total guess here - not incrementing the row pointer?

    Not your ornery onager



  • Closed Accounts Posts: 27,833 ✭✭✭✭ThisRegard


    What's your key and database you're using?


  • Registered Users, Registered Users 2 Posts: 6,488 ✭✭✭kingtut


    Esel wrote: »
    Total guess here - not incrementing the row pointer?

    Hmm not sure about that, is there somewhere in particular I can check it? It's not something I can recall configuring. Is it a table property?


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 6,488 ✭✭✭kingtut


    ThisRegard wrote: »
    What's your key and database you're using?

    Sorry total newb, not sure what you mean by key but it is an SQL database that pre-existed I am just adding a new table to it (the two tables the database previously are functioning perfectly).


  • Closed Accounts Posts: 27,833 ✭✭✭✭ThisRegard


    You shouldn't really need to worry about pointers in databases these days. Can you post the table definition?

    Each table in a database ideally has a key defined, such as an ID or some other unique field or combination of.

    SQL is just a language to interrogate databases, do you mean SQL Server?


  • Registered Users, Registered Users 2 Posts: 561 ✭✭✭sbs2010


    OP - you need to read up a bit on the SQL language and how it it used to manipulate data in a relational database.

    There are four statement types -

    Update
    Insert
    Delete
    Select

    So you need to know how these work and how your application uses them to access the database.


  • Registered Users, Registered Users 2 Posts: 6,488 ✭✭✭kingtut


    Sorry everyone limited internet access.

    Ended up fixing both of my issues, for those curious (and for those who offered help) here is what I did:

    1) Table data being overwritten - I had the transaction set to 'update' rather than 'import'.
    2) vba issue in excel report - Excel version had been updated and one command was no longer valid.

    Thanks again everyone :)


Advertisement