English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

anyone have any idea of how i could write a bat file which when run will delete everything from a certain table???

2007-03-22 19:00:45 · 2 answers · asked by Johnny B 1 in Computers & Internet Programming & Design

2 answers

Make an SQL script to delete te data, and have the batch file run your sql command line client with that file.

on linux/postgres it would be something like

echo "DELETE FROM sometable;" | psql -U user thedatabase

for more complicated code you should put it in a file and redirect it to standard input

2007-03-22 19:28:02 · answer #1 · answered by undercoloteal 3 · 0 0

you're figuring out on each and each and each little thing as quickly as you in simple terms decide directly to decide on one checklist. in the adventure that your internet internet site replaced into as basic as ebay with some million customers, then your code selects each and each customer, then it makes use of a loop to behave on the outcomes. you in simple terms isn't waiting to circumvent some loops in code, yet any long loop is going to sluggish down the reaction on the shopper end, shop in mind that very own domicile internet internet site is pre-processing, so their internet internet site hasn't even started out to load on the comparable time as your code is being processed. quite slender down so a protracted way as accessible utilising sq.. The database engine is optimised for this way of seek for, it would opt to get to the mandatory checklist or subset of records a lot greater advantageous devoid of postpone then your individual domicile internet internet site can loop by means of utilising it. in an attempt to function what you have learnt, initiate working with the 'the area' fact, additionally be careful of injection attacts, no programmer facilitates customer enter immediately into the database devoid of first ensuring they don't look injecting sq.. a powerful attributable to attempt that's to hire saved concepts, in case you ever application for a financial enterprise you will discover that each and each and each and one and all sq. is ran from saved concepts. There are some reasons, first that's larger obtainable to make it shield, yet 2nd because's some distance greater advantageous obtainable to maintain.

2016-12-19 12:00:20 · answer #2 · answered by lonsdale 4 · 0 0

fedest.com, questions and answers