I have a table that I need to insert into a database. It currently has only one field.
<tr><td>bla bla</td></tr>
<tr><td>bla bla2</td></tr>
<tr><td>bla bla3</td></tr>
Is it possible to insert the row position in the table to a database field and then the field value. So for the table above I need the records in the database to be
Row #, Bla_Bla_Value
1 bla bla
2 bla bla2
3 bla bla3
Does this make sence?
Insert Table into database and get row number
Page 1 of 14 Replies - 4673 Views - Last Post: 01 March 2010 - 12:25 PM
Replies To: Insert Table into database and get row number
#2
Re: Insert Table into database and get row number
Posted 05 February 2010 - 01:27 PM
It sounds as though you're confusing an HTML table with a database table (looks like that anyway).
That said, yes you can create a table in a database and then insert records using an ID number (what you called a row number) and a value. You can set up the database to auto-increment the id value of the record so that you don't have explicitly tell the database what the "row value" is. Any online resource regarding T-SQL would be a good place to start (SQL being the language that allows you to work with databases and their data).
That said, yes you can create a table in a database and then insert records using an ID number (what you called a row number) and a value. You can set up the database to auto-increment the id value of the record so that you don't have explicitly tell the database what the "row value" is. Any online resource regarding T-SQL would be a good place to start (SQL being the language that allows you to work with databases and their data).
#3
Re: Insert Table into database and get row number
Posted 06 February 2010 - 02:23 AM
Sorry Craig I was not very clear. I have a html page with a table on it and I want to scrap it basicly and insert the data into a database.
#4
Re: Insert Table into database and get row number
Posted 08 February 2010 - 07:59 PM
Well what you would have to do is basically treat your HTML table as XML and build a function that parses it looking for all values inside of Table.TR.TD. After that you just have to insert all the data.
#5
Re: Insert Table into database and get row number
Posted 01 March 2010 - 12:25 PM
mpryan73, on 06 February 2010 - 01:23 AM, said:
Sorry Craig I was not very clear. I have a html page with a table on it and I want to scrap it basicly and insert the data into a database.
You want to consume an HTML table and draw from it the information contained in the cells and save them to a database?
Yeah, what you'll want to do is either go to the trouble of building what amounts to a screenscrape function and then loop over the results of that and insert the gleaned data into a database table...
...or, if there isn't that much data, simply write the database insert statements by hand. The thing is, you could write the function to consume a table and spit out usable data on the backend but the write/test/fix cycle to build it so that it accurately runs at the end may be more trouble (read: "time and typing") than simply eyeballing the data on the screen and writing the SQL inserts manually.
Good luck with that.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|