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

Bi-sql insert into

2022-06-24 04:47:00 Powerbi white tea

INSERT INTO sentence

INSERT INTO Statements can usually be used in SQL Insert some row data for the table in the query of .

See here , Maybe the little friend will ask white tea , You didn't mean we were PowerBI You can use the query function in , What about this increasing function ? Don't worry. , Listen to white tea and tell you .

Basic grammar

grammar 1:

INSERT INTO  The name of the table  VALUES ( value 1,  value 2,....)

grammar 2:

INSERT INTO  The name of the table ( Column 1,  Column 2,...) VALUES ( value 1,  value 2,....)

reason

White tea explain , Why is this issue about a function that does not belong to a query statement .

Because once we use SQL Connect account , It has the function of reading and writing , So we're in PowerBI The add statement built in will be written back to SQL In the database of , This will affect our database , Therefore, this issue will specifically address this issue .

Using examples

Case data :

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

Let's have a look at it first “ Sales details ” The data of the branch column in .

SELECT DISTINCT  The branch where you are  FROM  Sales details 

There is a name “TEST” and “??” Two lines of special data .

And then we have PowerBI Import window for , Build new statements .

At this time, white tea uses the database administrator account , Have read and write permission .

INSERT INTO
        Sales details 
       ( The branch where you are )
       VALUES
       ('THETEA')

give the result as follows :

You can see that the message returned from the window is “ Affected lines ” by 1 That's ok .

We go back to SQL Enter the following query in to see how the data changes .

SELECT DISTINCT  The branch where you are  FROM  Sales details 

You can see at this point in PowerBI The data entered in has been returned to SQL In the database of .

Let's continue to copy the above query statements to PowerBI View in .

give the result as follows :

friends , You see , This data will also appear in PowerBI The query window of .

therefore , stay PowerBI Use in SQL At the time of statement , Be sure to remember :

  • Pay attention to the permission of the connection account , Whether it has read-write function
  • Not in PowerBI Build statements other than query functions in
  • Pay attention to the impact on the overall structure of the database

This is white tea , One PowerBI Beginners .

原网站

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