cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Microsoft Cameron
Microsoft

Re: How to use Insert Trigger on Azure SQL Database with 'Azure SQL' insert row ?

You can certainly simulate this using the Native query feature - this will execute a simple INSERT (nicely parameterized) which will not return the item, but will also avoid the problem of a SQL-side trigger.

 

As of now, you cannot use the InsertItem call, but this will do what we intend InsertItem to do in the future. 

 

Let me know if I can help further.

 

Thanks,

-Cameron

rgparisoto
Level: Powered On

Re: How to use Insert Trigger on Azure SQL Database with 'Azure SQL' insert row ?

Do you have any example @Cameron? Can I find something?

Microsoft Cameron
Microsoft

Re: How to use Insert Trigger on Azure SQL Database with 'Azure SQL' insert row ?

Certainly. If you Select the SQL Connector and the "Execute a SQL Query" operation, you can then enter the query and the formal parameters:

 

query: INSERT INTO [dbo].[PNQ_NewCustomer]([name])VALUES(@name)

formal parameters: { "name": "nvarchar(128)" }

 

This is obviously a very simple example, but you can extrapolate from here.

 

Thanks,

-Cameron

rgparisoto
Level: Powered On

Re: How to use Insert Trigger on Azure SQL Database with 'Azure SQL' insert row ?

Hi @Cameron!

I found an option do use Stored Procedures.

I made it work with an exception, I can't connect another tables, like when I want to make some logical with.

Do you know someone who used it with Power Apps? 

It will help me a lot to work with the company's inventory.

Thank you.

Regards.

Robson.

rgparisoto
Level: Powered On

Re: How to use Insert Trigger on Azure SQL Database with 'Azure SQL' insert row ?

Hi @Cameron!

Having good news here...

 

Do you know how to declare variables?

 

I'm trying this and it's not working:

DECLARE

[@Data] DATE,

SELECT
[@Data] = (SELECT TOP 1 [DataCompra]

FROM [dbo].[Ele_Compras]

WHERE [Id_Compra] = @{triggerBody()?['Id_Compra']} )

 

Is it the sabe like SQL Server?

 

Regards,

Robson.

Microsoft Cameron
Microsoft

Re: How to use Insert Trigger on Azure SQL Database with 'Azure SQL' insert row ?

@Robson If you are asking about SQL Syntax (I hope I am understanding your question properly...) - it would be like this:

 

formal parameters: { "id_compra": "date"}

 

actual parameters: id_compra: @{triggerBody()?['....']}

 

query: SELECT TOP(1)[DataCompra] FROM [dbo].[Ele_Compras] WHERE [Id_Compra]=@id_compra

 

Now you have a parameterized SELECT statement that can pass in the id from the previous step.

 

 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (6,023)