python - SQL Query for filling a SINGLE column with values -


I have an existing SQL database table which I am interacting with more than pyodbc. I wrote a class that uses pybackback to interact with the database by reading and creating and removing columns. The last bit of functionality I have the ability to fill a built-in column (filled in full by default) with prices from a python list (at which I'm planning to iterate and then final with DB codemat ()) By form - add extra columns or other columns without effect.

I tried to run the following query once again in the loop;

  INSERT VALUES (value) in the table_name (required_ column)  

Thus the class method;

  def writeToColumn (self, columnName, tableName, writeData): for typing items: self.cursor.execute ('INSERT INTO' + TableName + '(' + columnName + ') value ('+ Item +') '' self.cursor.commit ()  

Where values ​​represent the current index value of a list

but this is a whole new Adds the row and fills the cells of the columns with the null.

The other columns I have to do is being affected in any way, is there a question that can do this? ?

WARNING!

Not surprisingly, calling the INSERT will always include a new line, hence the name If you need to update an existing line, then you need to update the update.

  UPDATE table_name SET required_column = value WHERE ...  
< P> Where the condition identifies your current line in some way (through the primary key).


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -