Click here to Skip to main content
15,435,848 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Good morning.I have view in my database.
I need this view to run automatically, and update a table with the new data.
It's possible? how can i do it?
thank you very much for your help

What I have tried:

I tried several things I researched, but none of them worked.
Posted
Updated 21-Jul-22 2:09am
Comments
Richard MacCutchan 21-Jul-22 4:30am    
A view is a dynamic representation of some part(s) the database. It can only display data, not change it.
miguel santos 2021 21-Jul-22 4:42am    
Thank bro, but there's ny way i can do this?
Richard MacCutchan 21-Jul-22 4:48am    
No. You are asking how to change the wheel on a car by looking at a picture of the car.
miguel santos 2021 21-Jul-22 4:55am     CRLF
thanks again. I asked this question because I'm new to sql. And in a previous topic, I asked for help to create a field calculated with subtraction in a view. As they couldn't help me, I thought of using view to create and update a table, and make the calculated field in that table
Richard MacCutchan 21-Jul-22 5:17am    
If you are new to SQL (and any other tchnology) then rather than trying to guess things, make use of some of the excellent tutorials which will help you to understand what is, and is not, possible. The one I use most often is at SQL Tutorial[^].

1 solution

Well, a possibility to change data through view depends on database provider...

SQL Server: Modify Data Through a View - SQL Server | Microsoft Docs[^]
MySQL: MySQL :: MySQL 8.0 Reference Manual :: 25.5.3 Updatable and Insertable Views[^]
Postgres: PostgreSQL Updatable Views[^]
 
Share this answer
 
v2
Comments
CHill60 21-Jul-22 8:14am    
My 5. I was with Richard, thinking it cannot be done. I have learned something new today - thank you
Maciej Los 21-Jul-22 9:27am    
Thank you, Caroline. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900