I have a database wich contain 4 tables
-battery
-cell
-owner
each battery have multiple cell and one owner.
The cell table will contain a tons of entry.
i wanted a trigger that create view for each new battery that display the battery information and its cell’s information .
I had a postgre sql trigger that worked kinda well (thanks to stackoverflow 🙂 ) :
BEGIN
EXECUTE $$CREATE OR REPLACE VIEW battery_vue
AS
SELECT * FROM cells WHERE battery_serial = $$ || NEW.battery_serial;
RETURN NEW;
END;
but i’m unable to transpose it to SQL server and i have absolutly no clue on how to do it.
here is a simple diagram of my database :

So at the end for each new battery i need a view of it with its cells.
Ps : sorry if my english is not fluent :/
Hopefully this points you in the right direction…