Welcome to Geeklog, Anonymous Saturday, October 05 2024 @ 12:08 am EDT
Geeklog Forums
Converting Access database to story or forum
Nightvision
Anonymous
I have an access database that I would like to convert to stories or forum posts. Each entry has an entry number, title, description and a few other fields. Does anyone know how I could easily convert this database to stories or forum posts??
Thanks!!
4
8
Quote
Status: offline
jadiepoo
Forum User
Chatty
Registered: 01/11/03
Posts: 43
Try Access2MySQL
When you converted from access, you\'ll need to probably make modifications on the db to match the forum/story tables.
5
6
Quote
Status: offline
DTrumbower
Forum User
Moderator
Registered: 01/08/03
Posts: 507
Shouldn\'t be to hard. You can make INSERT SQL statements from the access data into the stories tables or topic table.
You would need to know certain fields that would need to be populated, like the sid, user security fields, etc.
If you want me to help, post the access table structure and I can generate some SQL for you or email me.
6
8
Quote
Status: offline
DTrumbower
Forum User
Moderator
Registered: 01/08/03
Posts: 507
This the minimum you would need.
INSERT INTO gl_stories( sid,date,title, introtext)
values( concat(CURDATE()+0, left(rand() * 1000000000,9)), curdate(), \"New title\", \"intro text\");
This will add a story to the General topic as anon. If you want to add the stories as admin, you would need to add the uid colum in the INSERT INTO clause and add the number 2 to the values.
INSERT INTO gl_stories( sid,date,title, introtext, uid)
values( concat(CURDATE()+0, left(rand() * 1000000000,9)), curdate(), \"New title\", \"intro text\",2);
If you want a different topic then add the column tid and then add \"a different topic\".
From access you can use SQL to create SQL, which will make your job a lot easier. You would do something like this.
Select \'INSERT INTO gl_stories( sid,date,title, introtext)
values( concat(CURDATE()+0, left(rand() * 1000000000,9)), curdate(), \"\' + field1 + \'\",\"\' + \"field2 + \'\");\"
That should get you going.
8
7
Quote
Nightvision
Anonymous
Thanks Dwight!! I am not really sure though what to do with this code? Sorry for being ignorant. Do i enter this into the tables via phpmyadmin? Do I insert everything including INSERT INTO?
Thanks
7
9
Quote
Status: offline
DTrumbower
Forum User
Moderator
Registered: 01/08/03
Posts: 507
In access, create a new query and switch to SQL view. Copy this Select \'INSERT INTO gl_stories( sid,date,title, introtext)
values( concat(CURDATE()+0, left(rand() * 1000000000,9)), curdate(), \"\' + field1 + \'\",\"\' + \"field2 + \'\") FROM TABLE1;\"
Subsitute the correct table fields for field1 and field2. Change the Table1 to the correct table. Run the query and it should produce SQL records that you would copy and paste into phpmyadmin to execute.
9
11
Quote
Nightvision
Anonymous
Thanks Dwight, i\'ll give it a shot.
10
7
Quote
Nightvision
Anonymous
I assume i go into Access and select create query in design view, select the tables and then go to sql view? When I do that I get an error saying characters found after SQL statement. Any ideas??
7
4
Quote
Status: offline
DTrumbower
Forum User
Moderator
Registered: 01/08/03
Posts: 507
I would go directly into sql view. No reason to select tables. You will type that in manually.
8
7
Quote
All times are EDT. The time is now 12:08 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content