Could someone please confirm what code language is it and how do I edit it to fit with Power BI function to import data from SQL Database please?
Got this from IT person but when I try to paste it into Power Query it gives error messages.
SELECT distinct Z.Territory , (z.AccountNumber ) as AccountNumber , (a.AccountType ) as AccountType , (z.CompanyName ) as CompanyName , (z.AccountNumber ) as AccountNumber , (z.CompanyName ) as CompanyName , z.SubscriptionReference ,z.SubscriptionID , (isnull(z.serialnumber,r.SerialNumber) ) as SerialNumber ,case when (rpc.billingperiodalignment) = 'AlignToCharge' then (z.product) else isnull(r.ProductDescription,z.product) end as Description , (r.ProductVersion ) as ProductVersion , (r.CoverExpiryDate ) as CoverExpiryDate , (z.SubscriptionStatus ) as SubscriptionStatus ,z.SubscriptionVersion
--, MAX(z.RenewalTerm) AS RenewalTerm , (z.[SubscriptionTermType]) as [SubscriptionTermType] , (case when z.[UnitofMeasure] = 'Desktop Users' then z.[Quantity] end) as 'Desktop Users' , (z.billingperiod ) as BillingPeriod ,(rpc.BillingPeriodAlignment) BillingPeriodAlignment ,(z.[ContractEffectiveDate]) as ContractEffectiveDate ,(z.TermEndDate) as TermEndDate
It's SQL, but it's invalid, so you'll need to get it fixed. It looks like it got cut off.When it's valid you should be able to paste it into a SQL Server Management Studio query window and test it.
To use it in Power Query useValue.NativeQuery , like this;
let
Source = Sql.Database("localhost", "adventureworks2017"),
Query = "
select *
from Sales.SalesOrderHeader
",
Data = Value.NativeQuery(Source, Query, null, [EnableFolding=true])
in
Data
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.