当前位置:网站首页>Bi-sql select into

Bi-sql select into

2022-06-25 01:13:00 Powerbi white tea

SELECT INTO

SELECT INTO Statement can usually be used to create a backup . I believe that the small partners will not be unfamiliar with the concept of backup , We're doing it BI When reporting , Or build DAX Function procedures like to PBI File backup . occasionally , This is a good habit , We can roll back the version in time when an error occurs .

Again , stay SQL in , The concept of backup is also very important , For example, we need to back up the database regularly , Or you need to back up certain tables and data at certain times .

purpose

  • Can be used to select data and insert it into another table

  • You can create a backup of a table and archive it

grammar

SELECT  Column (*) INTO  New table  [IN  database ] FROM  Source table 

Using examples

Case data :

In the database of white tea machine , There is a name “TEST” The database of , There is a name “Customer” and “Fact” Case data for .

Example 1:

Create a “Fact20210814” Of Fact Table backup .

SELECT * INTO Fact20210814 FROM Fact

give the result as follows :

Example 2:

Create a “FactAmount” Of Fact Table backup , among Amount Greater than 1300.

SELECT * INTO FactAmount FROM Fact WHERE Amount>1300

give the result as follows :

Example 3:

take Fact Table and Customer Table for combined query backup , Name it FactDetail.

SELECT Fact.AMOUNT,Customer.* INTO FactDetail From Customer JOIN Fact ON Customer.IDKEY=Fact.IDKEY

give the result as follows :

This is white tea , One PowerBI Beginners .

原网站

版权声明
本文为[Powerbi white tea]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202210542593923.html