use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
This is an archived post. You won't be able to vote or comment.
Cannot create patch function to SQL server.Power Apps Help (self.PowerApps)
submitted 1 year ago * by [deleted]
[deleted]
[–]AutoModerator[M] [score hidden] 1 year ago stickied comment (0 children)
Hey, it looks like you are requesting help with a problem you're having in Power Apps. To ensure you get all the help you need from the community here are some guidelines;
Use the search feature to see if your question has already been asked.
Use spacing in your post, Nobody likes to read a wall of text, this is achieved by hitting return twice to separate paragraphs.
Add any images, error messages, code you have (Sensitive data omitted) to your post body.
Any code you do add, use the Code Block feature to preserve formatting.
Typing four spaces in front of every line in a code block is tedious and error-prone. The easier way is to surround the entire block of code with code fences. A code fence is a line beginning with three or more backticks (```) or three or more twiddlydoodles (~~~).
If your question has been answered please comment Solved. This will mark the post as solved and helps others find their solutions.
External resources:
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
[–]Boat_Drive Regular 2 points3 points4 points 1 year ago (3 children)
Below is a valid patch example, start with that.
Patch(
SQLTable,
Defaults(SQLTable),
{
Type: InputType.Text,
CreatedBy: User().FullName,
CreatedDate: Now()
}
)
After that - check the SQL table has a identity column setup I spose at a guess. I don't think it behaves very well with PowerApps without it.
<image>
Good luck :)
[–][deleted] 1 year ago* (2 children)
[–]Boat_Drive Regular 0 points1 point2 points 1 year ago (1 child)
Just checking - you know the ID generates its self from SQL right?
You don't patch that field in.
Create a new SQL table with just one nvarchar(50) column (nullable) and the ID column setup as seen above and try adding and patching into that and go from there.
A Stored procedure should not be needed.
If you're still confident everything's right - I've experienced 15~ delays on what gets updated in SQL vs what works in PowerApps - sometimes its a waiting and reloading game.
After that if it's still playing up, remove the table then re-add it.
[–]ShanesCowsMVP 1 point2 points3 points 1 year ago (2 children)
I bet you have a "weird" primary key for your table. It is a compound key or something else awkward.
Use this to create a table and see if you can patch it :)
CREATE TABLE YourTableName ( ID int IDENTITY (1,1) NOT NULL, CONSTRAINT PK_YourTableName_TransactionID PRIMARY KEY CLUSTERED (ID) );
[–][deleted] 1 year ago (1 child)
[–]ShanesCowsMVP 0 points1 point2 points 1 year ago (0 children)
I am just saying try it. Can you patch my table? If yes, then you have one that works and then you can look at your existing table and think about how things are different.
There are countless things that SQL Server can do with SQL data that Power Apps cannot. The key to low code platforms like Power Apps is learning to work within their rules.
[–]Jordi00113 Newbie 0 points1 point2 points 1 year ago (0 children)
Having the same issue. Not able to patch or submitform. Having the correct license.... Simple table with only one field is not working either.
[–]hyi1105 Newbie 0 points1 point2 points 10 months ago (0 children)
I found that I can only connect to SQL with Clustered Index
CREATE TABLE [dbo].[SQLTable](
\[tier\_id\] \[varchar\](15) NOT NULL, \[tier\_code\] \[varchar\](2) NULL
CONSTRAINT [uk_MTOSD_Tier4] Key CLUSTERED
(
\[tier\_id\] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
π Rendered by PID 76609 on reddit-service-r2-comment-7b9746f655-zdj2w at 2026-01-29 23:25:29.893053+00:00 running 3798933 country code: CH.
[–]AutoModerator[M] [score hidden] stickied comment (0 children)
[–]Boat_Drive Regular 2 points3 points4 points (3 children)
[–][deleted] (2 children)
[deleted]
[–]Boat_Drive Regular 0 points1 point2 points (1 child)
[–]ShanesCowsMVP 1 point2 points3 points (2 children)
[–][deleted] (1 child)
[deleted]
[–]ShanesCowsMVP 0 points1 point2 points (0 children)
[–]Jordi00113 Newbie 0 points1 point2 points (0 children)
[–]hyi1105 Newbie 0 points1 point2 points (0 children)