Updating views in sql

The following INSERT statement uses multiple SET clauses to add two rows to NEWCOUNTRIES: proc sql; insert into sql.newcountries set name='Bangladesh', capital='Dhaka', population=126391060 set name='Japan', capital='Tokyo', population=126352003; title "World's Largest Countries"; select name format=., capital format=., population format=comma15.0 from sql.newcountries; World's Largest Countries Name Capital Population ------------------------------------------------------ Brazil Brasilia 160,310,357 China Beijing 1,202,215,077 India New Delhi 929,009,120 Indonesia Jakarta 202,393,859 Russia Moscow 151,089,979 United States Washington 263,294,808 Bangladesh Dhaka 126,391,060 Japan Tokyo 126,352,003 With the VALUES clause, you assign values to a column by position.The following INSERT statement uses multiple VALUES clauses to add rows to NEWCOUNTRIES.So, yes, you can update the data in a SQL VIEW providing you have the proper privileges to the underlying SQL tables.

updating views in sql-41updating views in sql-4

See the results of the DESCRIBE TABLE statement in Creating Tables Like an Existing Table for information about the columns of NEWCOUNTRIES.However, if you try to query the SQL VIEW after the table has been dropped, you will receive a message indicating that the SQL VIEW has errors.If you recreate the table (the table that you had dropped), the SQL VIEW will again be fine.Under most conditions, you can insert data into tables through PROC SQL and SAS/ACCESS views. With the SET clause, you assign values to columns by name.The columns can appear in any order in the SET clause.

Leave a Reply