Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
5.00/5 (2 votes)
See more:
what is the command for insert data into view?
Posted

hi alirezamilani,

Please check below url for your reference

Views In SQL Server[^]
 
Share this answer
 
Hi,

Refer the below link to insert data into view.

http://www.java2s.com/Tutorial/SQLServer/0320__View/Insertintoaview.htm[^]
 
Share this answer
 
You task is depend on complexity of the view. If you create a view using single table, you can insert the data using normal insert statement. If you create complex view by joining multiple tables, this is bit hard. You may have to use "INSTEAD OF Triggers"

http://msdn.microsoft.com/en-us/library/ms175521.aspx
 
Share this answer
 
v2
Hi
You can insert data into view if bellow conditions are ok.
1- your view getting data from table (some view hasn't table in it's background)
2- hole of columns in your view are insert-able
3- your view has not group by in construction
4- another columns in your tables(that your view is construct from they) have default value or are null-able

if upper conditions it's OK for your view you can use from bellow script for this action:

Insert [ServerName].[SchemaName].[ViewName] (FirstColumnName, ...)
Values(FirstColumnValue, ...)
 
Share this answer
 
HI,

Check the following links for your answer.

Insert data into a view (SQL Server)
nserting to a View

Thanks
 
Share this answer
 
Insert x in to blah. It's just a normal insert statement.
 
Share this answer
 
Hi,

Insert data directly into respective tables your view get automatically updated.
 
Share this answer
 

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