Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - best option for updating table??
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

best option for updating table??

 Post Reply Post Reply
Author
the boss View Drop Down
Senior Member
Senior Member
Avatar

Joined: 19 January 2003
Location: Saudi Arabia
Status: Offline
Points: 1727
Post Options Post Options   Thanks (0) Thanks(0)   Quote the boss Quote  Post ReplyReply Direct Link To This Post Topic: best option for updating table??
    Posted: 28 June 2003 at 12:28am

i have a table in SQL server 2000 database which need to be updated monthly.. it is required to delete all the record in the table before updating it. the table consist of 6000+ records..the database which contains this table held on the hosting servers located in US

what is the best option to do this beside enterprise manager...

secondly...the data i want to insert in my table is stored in a CSV format file. is it possible that i may upload the CSV file on the hosting server and use ASP to import data from CSV file into the SQL server.

Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 28 June 2003 at 8:10am

truncate table tablename

BULK INSERT tablename
        FROM 'c:\inetpub\wwwroot\yoursite\yourfile.csv'
        WITH
        ( FIELDTERMINATOR = ',',
        ROWTERMINATOR = '\n',
        KEEPIDENTITY
        )

Take the keepidentity out if you don't have an ident column, you might have to set other parameters based on your data but you should get the idea. check the online book
    

Back to Top
the boss View Drop Down
Senior Member
Senior Member
Avatar

Joined: 19 January 2003
Location: Saudi Arabia
Status: Offline
Points: 1727
Post Options Post Options   Thanks (0) Thanks(0)   Quote the boss Quote  Post ReplyReply Direct Link To This Post Posted: 28 June 2003 at 7:18pm

yup i got the whole of it.. thanks a lot..

but the data base server is a different physical server than the web server. so i cant use it ...the above example will only work provied that webservr and datanbase servers r on the same physical server..

i could think of a software based solution which can read the CSV file from my PC or the hosting server and do the task or an ASP solution which can do it all...

i dont care it is cost me to install and buy a component provided that component doest cost a fortune..



Edited by the boss
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 28 June 2003 at 10:08pm
You can simply create a dts package, then use xp_cmdshell "dtsrun ...." to execute it via asp
Back to Top
the boss View Drop Down
Senior Member
Senior Member
Avatar

Joined: 19 January 2003
Location: Saudi Arabia
Status: Offline
Points: 1727
Post Options Post Options   Thanks (0) Thanks(0)   Quote the boss Quote  Post ReplyReply Direct Link To This Post Posted: 30 June 2003 at 5:05am

played around with the DTS package little bit..well i think to use th mentioned method.. i still need file system access to the Db server or the network share path where the CSV file is stored..

i think an ASP page with all the data from the CSV file in it can be made which will do all the opreation but the amount of data to be inserted is around 2.5 MB when in a raw text format (.asp, .csv, .txt) and i bet that would kill the server and hosting ppl with be mad @ me

the only viable solution i can think of is to import the CSV into MDB, then upload it to the hosting and make some ASP which will first delete all the records in the table and then read te MDB and insert the records into the table on SQL server in batches of 50 or 100 so they dont eat up all the processor cycles and kill the web server

OR

import CSV into MDB and then use the access upsize wizard to export all data to SQL server with a differnt table name..well this would take long time tho but i dont think more than 30 minutes in a 500+K upload speed...after all data has ben upsized sucessfully.. use ASP or enterprise manager to delete the old table and rename new table to coressponding name and change coloum data types.. i prefer to do the table renaming and deleting using ASP bcuz that way i could update the Db from anywhere regardless the availibility of enterprise manager and top of everything it just sucks when usuing enterprise manger to manage database remotely unless u got T1

suguesstion for a better solution are still welcome..bear in mind that the table is required to be updated every 30-40 days and all old records MUST be deleted before new ones are inserted.. ..

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.