tag:blogger.com,1999:blog-5334232245085456076.post2805046876974489152..comments2024-01-27T03:41:15.871-08:00Comments on Dimant DataBase Solutions: Scheduling database backup in SQL 2005 Express EditionUri Dimanthttp://www.blogger.com/profile/17252545378139162559noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-5334232245085456076.post-67852699899674429442009-04-24T14:41:00.000-07:002009-04-24T14:41:00.000-07:00Hello
I am a student at Faculty of Electrical Eng...Hello<br /><br />I am a student at Faculty of Electrical Engineering and Computer Science in Maribor (Slovenia).<br />I am studying Automation<br />I am working on a project based on SQL 2005 Express Edition with SCADA as foreground control system.<br />I am new at SQL programing so I would ask for your help. I found your blog post for Scheduling database backup in SQL 2005 Express Edition and helped me a little to understand the procedure.<br />But I am still quite "in the dark" with my issues.<br />What I have to do is:<br />I have one database in which are 2 tables: Data and Alarms. Now, another database (backup) has to be created and table Data needs to be copied (data) into it at the first day of the every month.<br />For example, at May 01, at 0:00 table Data will be copied into the backup database and will be named Data_april_09. So this would be a monthly backup of the table Data. <br />Table Data from the original database has to be deleted after the backup proces.<br />The same procedure has to be with the table Alarms but every new year (so, once yearly). So the backuped Alarms database would be called Alarms_09.<br />Here also table Alarms from the original database has to be deleted after the backup proces.<br />Now, since those two pocedures will be runned from SCADA (actual schedule will be maintained) I need a script (maybe 2 - one for monthly and one for a yearly backup), that will be runned from it.<br /><br />I have found SQL commads (not all) that I think are apropriate for my problem, but I do not not know how to put them into one usefull piece of code:<br /><br />To copy a table from one database to another I need the command:<br /><br />SELECT * INTO backUP_database_name.dbo.BackUP_table_name FROM Database.dbo.Original_table_name<br /><br />Then to delete data from the original table when the data is copied to backup:<br /><br />TRUNCATE table Original_table_name<br /><br />The backup database has to be created manualy or it can be created sheduled every year?<br /><br />I would be very grateful if you would help me with my issue. I have found SQL as very usefull tool in my future business and career.<br /><br />Have a nice day,<br />Vedran Budinskivedrohttps://www.blogger.com/profile/11677985360665933982noreply@blogger.com