Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Upgrade script from Access to MSSQL
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Upgrade script from Access to MSSQL

 Post Reply Post Reply
Author
Bjørn Holm View Drop Down
Newbie
Newbie


Joined: 07 April 2002
Location: Norway
Status: Offline
Points: 27
Post Options Post Options   Thanks (0) Thanks(0)   Quote Bjørn Holm Quote  Post ReplyReply Direct Link To This Post Topic: Upgrade script from Access to MSSQL
    Posted: 28 July 2006 at 2:15pm
Not sure if this is excactly the right place to post this question, but it is somewhat relevant to this forum I guess;
 
I have made a .asp-script that imports all data from WWF-v.8 access tables to MS-SQL WWF-v.8 tables. But I am not able to import the correct ID(used for primary key) for all tables (eg. author_id from the tblAuthor table). MSSQL refuses to let me use the imported value, and insists on priming a new value for these fields. This means that all relations between tables goes out the window.
Anyone knows how to overwrite the Ident column of the MSSQL-tables?
 
 
Heres an exampe of my code:
 
 Do While Not NewsTableInn.EOF
  NewsTableUt.AddNew
  'NewstableUt.Fields("Cat_ID")               = NewstableInn.Fields("Cat_ID")   <----- This line causes error
  NewstableUt.Fields("Cat_Name")                = NewstableInn.Fields("Cat_Name")
  NewstableUt.Fields("Cat_Order")                 = NewstableInn.Fields("Cat_Order")
  NewsTableUt.Update
  NewsTableInn.MoveNext
 Loop
 
 
If I get this to work, I can post the final script here if someone is interrested.
 
regards,
Bjørn Holm
Back to Top
Skeever View Drop Down
Newbie
Newbie


Joined: 25 February 2003
Location: Norway
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote Skeever Quote  Post ReplyReply Direct Link To This Post Posted: 28 July 2006 at 6:34pm
Why don´t you read it into a GetRows array and then create a simple stored procedure to take care of the insert part using SET IDENTITY_INSERT ON

See here for more info on the identity part. (http://www.sqlteam.com/item.asp?ItemID=8003)

That might give you some better performance.
Back to Top
Bjørn Holm View Drop Down
Newbie
Newbie


Joined: 07 April 2002
Location: Norway
Status: Offline
Points: 27
Post Options Post Options   Thanks (0) Thanks(0)   Quote Bjørn Holm Quote  Post ReplyReply Direct Link To This Post Posted: 29 July 2006 at 10:08pm
Hi Skeever. Thanks for the reply.
I don't really need any better performance, as this is a one time job only, and this simple script works fine except for the mentioned problem.
Doesn't anyone know how to overwrite the autoincremented value from the IDENT column in a MSSQL table?
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 31 July 2006 at 11:00am
You could try using an SQL ALTER query to alter the table so that the IDENT fields are set to an INT datatype during the transfer process, then Alter the tables back to IDENT data type after the process is complete.

Never tried this, but in theory I think it should work.
Back to Top
balearicjobs View Drop Down
Groupie
Groupie
Avatar

Joined: 13 July 2002
Location: United Kingdom
Status: Offline
Points: 86
Post Options Post Options   Thanks (0) Thanks(0)   Quote balearicjobs Quote  Post ReplyReply Direct Link To This Post Posted: 01 August 2006 at 4:36pm
If you get this script working, would you please be kind enough to post it up. I've tried several times to upgrade my forum from access to SQL but without any luck.
 
Thank you.
Thanks for your help!!!
Kind Regards
Rob,
Balearic Jobs
Helping young people find seasonal work in the Balearic Islands, including vacancie
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.