Welcome to Geeklog, Anonymous Saturday, November 30 2024 @ 07:42 pm EST
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!!
6
9
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.
7
7
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.
7
9
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.
9
8
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
9
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.
10
13
Quote
Nightvision
Anonymous
Thanks Dwight, i\'ll give it a shot.
12
8
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??
9
6
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.
10
9
Quote
All times are EST. The time is now 07:42 pm.
- 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