Hello everyone, we know that the greatest difficulty for large software such as ERP lies in the arrangement and maintenance of large databases.
Table backup, as its name implies, backs up a table.
So when do we need table backup?
Table backup is a temporary backup when you test the stored procedure or delete a table that has important data in a large ERP Database.
Table backup is a required course for SQL experts. Let's not talk about it.
-- Create a temporary data first. Create Table # tab (ID int, country nvarchar (10), sex int, popu INT) insert into # tab values (1, 'China', 1, '123 ') insert into # tab values (2, 'China', 2, '000000') insert into # tab values (3, 'u.s. ', 1, '45 ') insert into # tab values (4, 'America ', 2, '55') insert into # tab values (5, 'Canada', 1, '51 ') insert into # tab values (6, 'Canada ', 2, '49') insert into # tab values (7, 'uk', 1, '40 ') insert into # tab values (8, 'uk ', 2, '60') Select * from # Tab
One of the table backup Syntax: temporary table --> temporary table backup
-- In this case, we put the # tab into a # tab2 to select * into # tab2 from # Tab
We can query # tab2 to get the result.
Table backup syntax 2: temporary table --> physical table backup
SELECT * INTO MyERP.dbo.MyTab FROM #tab
OK, so we can store the data in our temporary table directly to quickly create an entity table.
The query content is the same
Table backup syntax 3: entity table --> entity table backup
SELECT * INTO MyERP.dbo.MyTab2 FROM MyERP.dbo.MyTab
In this case, the object table mytab obtains mytab2.
The data is also obtained.
Continue to extend... IP host-IP host table backup
This topic is a little dangerous and may be a little complicated. It involves some gateway problems, but you can imagine the principle of database loss for several large websites a while ago. Do not underestimate the basics. Experts use these foundations together.