How to create view that has an update statement

Tools: MS Management Studio SQL 2008 R2
Code:
Create View as Mocha
UPDATE dbo.Cola
SET Login_ID = Replace(PE15,RTRIM(Cast(Login_ID),'')
UPDATE dbo.cola
SET P4 = NullIf(P4,'')
I would like to create a database object "View" to hand it over to a user and run the script. How I would create a a view that would accept an update statement. Are any work around to accomplish this goal

Not quite sure what you want to achieve.
However, if your view displays rows from a single table and each row relates to exactly one row in the source table (no aggregates, no join, no transformation) then you can update it.  The update will be executed on the table it refers to.
If you view is more complex, contains joins, aggregates and such, you can create a trigger on it to update the base table(s).
The conditions for a view to be updatable are a little more complex then what I wrote but you can find it here under "updatable view":
http://msdn.microsoft.com/en-CA/library/ms187956.aspx
In the end, you would have a view which displays rows and can be updated.
If all you want is to modify rows without viewing them then HuaMin Chen's solution is the one for you, create a stored procedure instead.

Similar Messages

  • How to create View Object with Multiple Updatable Entity Objects

    I want both the entities in the view object to support creating new rows but when i give create insert it allows to insert only on the parent and not the child. I found this link
    http://docs.oracle.com/cd/E21043_01/web.1111/b31974/bcadvvo.htm#CEGCAJCI which overrides the exiting classes. but i would like to do it declarative . Is there any other way to do it?
    I am using Jdeveloper 11g version 2.
    Thanks in advance,
    Rakesh

    But when i tried to add a new row it showed this error
    oracle.jbo.AttrValException: JBO-27014: Attribute LookupTypeId1 in FoundationModuleAM.VikLookupTypeBaseVO is required.
         at oracle.jbo.server.JboMandatoryAttributesValidator.validate(JboMandatoryAttributesValidator.java:224)
         at oracle.jbo.server.EntityDefImpl.validate(EntityDefImpl.java:3095)
         at oracle.jbo.server.EntityCache.validate(EntityCache.java:3599)
         at oracle.jbo.server.EntityImpl.validateEntity(EntityImpl.java:2285)
         at oracle.jbo.server.EntityImpl.validate(EntityImpl.java:2464)
         at oracle.jbo.server.DBTransactionImpl.validate(DBTransactionImpl.java:4515)
         at oracle.insurance.viking.foundation.model.common.VikingDBTransactionImpl.validate(VikingDBTransactionImpl.java:46)
         at oracle.jbo.server.DBTransactionImpl.commitInternal(DBTransactionImpl.java:2008)
         at oracle.jbo.server.DBTransactionImpl.commit(DBTransactionImpl.java:2352)
         at oracle.insurance.viking.foundation.model.common.VikingDBTransactionImpl.commit(VikingDBTransactionImpl.java:37)
         at oracle.adf.model.bc4j.DCJboDataControl.commitTransaction(DCJboDataControl.java:1590)
         at oracle.adf.model.binding.DCDataControl.callCommitTransaction(DCDataControl.java:1415)
         at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1428)
         at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:2169)
         at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:731)
         at oracle.jbo.uicli.jui.JUActionBinding.actionPerformed(JUActionBinding.java:193)
         at oracle.jbo.uicli.controls.JUNavigationBar.doAction(JUNavigationBar.java:412)
         at oracle.jbo.jbotester.NavigationBar.doAction(NavigationBar.java:112)
         at oracle.jbo.uicli.controls.JUNavigationBar$NavButton.actionPerformed(JUNavigationBar.java:118)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
         at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
         at java.awt.Component.processMouseEvent(Component.java:6289)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
         at java.awt.Component.processEvent(Component.java:6054)
         at java.awt.Container.processEvent(Container.java:2041)
         at java.awt.Component.dispatchEventImpl(Component.java:4652)
         at java.awt.Container.dispatchEventImpl(Container.java:2099)
         at java.awt.Component.dispatchEvent(Component.java:4482)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
         at java.awt.Container.dispatchEventImpl(Container.java:2085)
         at java.awt.Window.dispatchEventImpl(Window.java:2478)
         at java.awt.Component.dispatchEvent(Component.java:4482)
         at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
         at java.awt.EventQueue.access$000(EventQueue.java:85)
         at java.awt.EventQueue$1.run(EventQueue.java:603)
         at java.awt.EventQueue$1.run(EventQueue.java:601)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
         at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
         at java.awt.EventQueue$2.run(EventQueue.java:617)
         at java.awt.EventQueue$2.run(EventQueue.java:615)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

  • How to Create inspection that assign to Purchase Order / Material Document

    Dear QM Master,
    I am using QA01 to create inspection lot but can any master tell me , How to Create inspection that assign to Purchase Order / Material Document ?
    Appreciate.
    Thank you.

    Hello,
    When you create an inspection lot manually, you cannot reference an original document (for example, a goods receipt document, an order, or a delivery note).
    In QA01 you can create inspection lot manually for all inspection lot origins except the following:
    10 - Delivery to customer with sales order
    11 - Delivery to customer without sales order
    12 - General delivery
    13 - Repetitive manufacturing
    14 - Plant maintenance
    You can also refer this link
    http://help.sap.com/saphelp_47x200/helpdata/en/2d/3519d8448c11d189420000e829fbbd/frameset.htm
    Please check and revert.
    Regards,
    Priyanka

  • How to create view for xmltype table in oracle

    hi:
    Can some one help me how to create view for xmltype table in oracle?
    XMLType do not have column
    Sem

    Thank you !!
    I read it and become very hard to implement what I want to do.
    Can you give me example please?
    My main goal to create view for xmltype table is to XQuery the XML data?
    Do you have any other suggestion?
    Please help
    Ali_2

  • Acquired ayrport Express, configured it, but how to create one that I could plug in other devices, it needs to register each new device that connects to it .... What to do?

    Acquired airport Express, configured it, but how to create one that I could plug in other devices, it needs to register each new device that connects to it .... What to do?

    Acquired airport Express, configured it, but how to create one that I could plug in other devices, it needs to register each new device that connects to it .... What to do?

  • TS3276 My sent box is empty in my home account...how do I view what has been sent?

    My sent box is empty in my home account...how do I view what has been sent?

    Select the Mailbox (one click) then go to the Mailbox menu, and select Rebuild (the last item in the drop down).

  • How to create script that run sudo-command?

    I often need to run command:
    sudo "/Library/Application Support/VMware Fusion/boot.sh" --restart
    This needs to be run as admin.
    Can anybody tell me how to create script that will login as admin and run that command in terminal?
    Or from where can I get help how to add commands to a script?
    Thanks
    Tomi

    Your best bet on getting a cogent answer is to post to the Unix forum under OS X Technologies.

  • I copied a jpg on icloud drive on my macbook pro. How do i view that jpg on my iphone 6 plus? Macbook Pro is on Yosemite and iphone on 8.1.

    I copied a jpg to the icloud drive on my macbook pro. How do i view that jpg on my iphone 6 plus? Macbook Pro is on Yosemite and iphone on 8.1.

    Hello Sunil Gubbi,
    Thanks for using Apple Support Communities.
    From your post I understand that you'd like to know on how to access your files on iCloud Drive.  Please take a look at the information below on how to access the files.
    You can access your files in iCloud Drive any of these ways:
     Using any supported web browser, you can go to iCloud Drive or iWork for iCloud beta at iCloud.com. In iWork for iCloud beta, you can find your Pages, Numbers, and Keynote files.
    On your Mac with OS X Yosemite, you can go to iCloud Drive in Finder.
    On your PC with Windows 7 or later and iCloud for Windows 4.0, you can go to iCloud Drive in File Explorer.
    On your iPhone, iPad, or iPod touch with iOS 8, you can access your files from Apple apps like Pages, Numbers, and Keynote, or any apps that support iCloud Drive.
    iCloud Drive FAQ
    Take care,
    Alex H.

  • How to CREATE VIEW to merge two tables each of which has CLOB-typed column

    I failed in creating a view to merge two tables that have CLOB-type column each.
    The details are:
    Database: Oracle 9i (9.2.0)
    Two tables "test" and "test_bak", each of which has the following structure:
    ID Number(10, 0)
    DUMMY VARCHAR2(20)
    DUMMYCLOB CLOB
    The following operation fails:
    create view dummyview (id, dummy, dummyclob) as
    select id, dummy, dummyclob from test
    union
    select id, dummy, dummyclob from test_bak;
    I was announced:
    select test.id, test.dummy, test.dummyclob
    ERROR in line 2:
    ORA-00932: inconsistent data type: required - , but CLOB presented.
    But if creating views from only ONE table with CLOB-type columns, or from two tables WITHOUT CLOB-typed columns, the creation will succeed. The following 1) and 2) will succeed, both:
    1) one table, with CLOB-typed column
    create view dummyview (id, dummy, dummyclob) as
    select id, dummy, dummyclob from test;
    2) two tables, without CLOB-typed columns
    create view dummyview (id, dummy) as
    select id, dummy from test
    union
    select id, dummy from test_bak;
    I want to merge the two tables all, with complete columns, how to write the CREATE VIEW SQL statement?
    many thanks in advance

    Dong Wenyu,
    No.
    But you could do this:
    SELECT source.*, nvl (tab1.clob_column, tab2.clob_column)
    FROM your_table1 tab1, your_table2 tab2, (
    SELECT primary_key, ...
    FROM your_table1
    UNION
    SELECT primary_key, ...
    FROM your_table2
    ) source
    WHERE source.primary_key = tab1.id (+)
    AND source.primary_key = tab2.id (+)
    In other words, do the set operation (UNION (ALL)/INTERSECT/MINUS) on just the PK columns before pulling in the LOB columns.
    d.

  • How to create view like Facebook - Profile, Wall portion in my iphone apps

    Hi,
    I have to create same that type of view for my application. my requirement like that i have one question and user can give answer of my question with unlimited number of lines. SO obviously we have to use UITableView. Now problem is that how can i decide my table row height and if there is two lines then answer portion should be small and if answer portion is big then it should be large with unlimited answers.
    Does anyone know how to create this type of table view.
    Thanks.
    Message was edited by: crazyiphony

    Hi,
    i suggest reading some documentation. First you nedd to "tell" the tableView that it's rows are of different height. So you need to implement "tableView:heightForRowAtIndexPath:"
    To calculate the height needed for a specific text you can use one of the "sizeWithFont" methods of NSString class. (http://developer.apple.com/iphone/library/documentation/UIKit/Reference/NSStringUIKitAdditions/Reference/Reference.html)

  • How to create view in OBIEE

    I have table 'Table 1' with columns Attr1,Attr2,Measure 1,Measure 2.I need to create view in the repository from table with Attr1,Measure1 and new Attribute 3 with values as flag 'Y' in to it.What will be the SQL for the new view.Please provide the exact Syntax for the view.
    Thanks in Advance

    Hi Hsekar,
    The view SQL Syntax is standard ANSI SQL. From what I understand, you have a table named "Table 1" which has four columns, "Attr1", "Attr2", "Measure 1", "Measure 2". You want to create a new measure named "Attribute 3" (I'd recommend not having spaces in your column and table names FYI).
    If that's correct, then try this
    1. In the physical layer, change the object type to view.
    2. Put the following SQL in the box
    Select "Table 1"."Attr 1","Table 1"."Measure 1", 'Y' "Attribute 3"
    From "Table 1"
    3. Define your columns in the object appropriately.
    That should do it for you.
    -Joe

  • How to create monitor entries from an update routine?

    Hi,
    Does anyone try to create monitor entries in ABAP routine in update rules?
    I have How-to guide "How to... Create monitor entries from an update routine". I applied code from it.
    RETURNCODE = 1.
    MONITOR-MSGID = 'RSM'.
    MONITOR-MSGTY = 'W'. *** I also tried MONITOR-MSGTY = 'E'
    MONITOR-MSGNO = '799'.
    MONITOR-MSGV1 = 'My message '.
    MONITOR-MSGV2 = COMM_STRUCTURE-<MY_FIELD>.
    append MONITOR.
    EXIT.
    But it doesn't work. I don't see new lines on Details tab in AWB Monitor.
    What's wrong?
    BW 3.0B

    Hi, hope you had a good weekend.
    I tried with MSGTY = 'I' and I didn't get any errors or warnings at load.
    In the monitor, on the detail tab, I find hidden under:
    Processing (data packet)
    -> Data Package x
       -> Transfer rules
          -> Data records for package x
             -> Record 0:
             -> Record 0:
             -> Record 0:
    When I select "Display Message(s)" from the dropdown-menu on one of these "Record 0:" lines, I get to see
    my message text: S:RSM:000 test1 test2
    1) how can I change the text that appears in the monitor tree ("Record 0:") ?
    2) The status of these nodes is always a green led (also with MSGTY = 'W')... shouldn't it be a yellow triangle?
    Like this it is hell to find your warnings/information messages.
    3) I cannot find my monitor messages with transaction SLG1... should I be able to find them there?
    Kind regards,
    Edwin

  • How to build View that join 2 tables that one of them exists twice in join

    Hello ,
    I want to create a database view (in CRM) which joins 
    the following tables : but000 , but050 , but000 again .
    but000 holds BP general data (including BP name).
    but050 holds the connection (relationship) between two BPS.
    I want to build a dictionary view that shows a relation between
    two BP and I want also to see their names ... that's why I need
    but000 twice ..
    I didn't manage doing this in SE11 (like I can do it with abap code).
    I need this view in order to use it in a search help I need to build.
    Does anyone know a way to build a view like this ?
    If it is not possible how can I build a search help that shows
    relation with names ?
    Please , help .
    Thanks ,
      N.S.

    Creating a Database View
    Procedure
    1.Enter an explanatory short text in the field Short text.
    You can for example find the view at a later time using this short text.
    2.Define the tables to be included in the view in the Tables field of the Tables/Join conditions tab page.
    Keep in mind that you can only include transparent tables in a database view.
    3.Link the tables with join conditions.
    If there are suitable foreign keys between the tables, you should copy the join conditions from these foreign keys (see  Foreign Key Relationships and Join Conditions).
    Place the cursor on a table name and choose Relationships. All foreign keys to other tables defined for this table are displayed. Select the foreign keys and choose Copy. The join condition is now derived from the definitions in the foreign key.
    If you only want to see the foreign key relationship existing between two tables, you must first select these two tables (click on the first column of the input area Tables) and then choose Relationships.
    4.On the View fields tab page, select the fields that you want to copy to the view.
    Choose Table fields. All the tables contained in the view are displayed in a dialog box. Select a table. All the fields contained in this table are displayed. You can copy fields by selecting them in the first column and choosing Copy.
    You can also include an entire table in the view (see Includes in Database Views).
    5.On the Selection conditions tab page, you can (optionally) formulate restrictions for the data records to be displayed with the view (see Maintaining Selection Conditions for Views).
    The selection conditions define the data records that can be selected with the view.
    6.With Goto ® Technical settings, you can (optionally) maintain the technical settings of the database view.
    You can define whether and how the database view should be buffered here. Proceed as for the technical settings of a table (see  Maintaining Technical Settings). Note that only the settings for buffering can be maintained for database views.
    7.On the Maintenance status tab page, select the maintenance status of the database view.
    If the view contains more than one table, the maintenance status read only cannot be altered.
    8.Save your entries. You are asked to assign the view a development class.
    You can change this development class later with Goto ® Object directory entry.
    9.Choose  activate.
    Girish

  • How to create view with schemabinding on cross datbases(partitioned views)

    Hello Everyone,
    Please help me to sort this issue. I know it is not possible bind the scheman in below example. But is there any solution to solve this issue.
    I've tables like below
    create database D1--First database
    create table dbo.t1(
    id int
    create database D2--Second database
    create table dbo.t2(
    id int
    i want to create a view with the schema binding option on this
    create database D3
    use d3
    create view vw_v1
    with schemabinding
    as
    select id from d1.dbo.t1
    union all
    select id from d2.dbo.t2
    I'm getting this below error
    Msg 4512, Level 16, State 3, Procedure vw_v1, Line 7
    Cannot schema bind view 'vw_v1' because name 'd1.dbo.t12' is invalid for schema binding. Names must be in two-part format and an object cannot reference itself.
    Many thanks
    A-ZSQL

    CREATE VIEW
    SCHEMABINDING
    Binds the view to the schema of the underlying table or tables. When SCHEMABINDING is specified, the base table or tables cannot be modified in a way that would affect the view definition. The view definition itself must first be modified or dropped to remove
    dependencies on the table that is to be modified.
    > When you use SCHEMABINDING,
    the select_statement must include the two-part names (schema.object)
    of tables, views, or user-defined functions that are referenced.
    >
    All referenced objects must be in the same database.
    José Diz     Belo Horizonte, MG - Brasil

  • How to create views in OBIEE?

    Hi everyone,
    I'm new to OBIEE. My requirement is i need to apply different filters to each columns in a report. But if i apply any filter it is applying to all the columns.
    For example, My report column is something like
    StudentsPassed || StudentsFailed || StudentsTrasnfered
    So i need to look up on a status column and need to show only a particular result based on the status column. But if i select for status=StudentsPassed then in all three column im getting only students passed.
    So what i did is i created individual views for each column. i.e View1 will hold the list Students Passed view2 will hold only list of Students Failed. But now i need to generate many reports of same type. So i don't think it is a best idea to create views for each columns in a report in the database level.
    Is there any method to do this?
    Is there any method to store only Students Passsed list in a logical column in the Administration level?
    Please provide some help.
    Thanks in advance,
    karthick

    What are you trying to get?
    This is normal error, you must use measure in FILTER (USING), you are using maybe foreign key in count distinct or some other columns that is not a measure.
    1. If you like to use FILTER (USING) go to RPD, BMM and make new measure, etc MEASURE2=count(distinct student_id), etc.
    Then applied this MEASURE2 in FILTER(MEASURE2 USING (VEE_TOTAL.STATUS = 3.00)
    or
    2. Use views as I explained before
    Regards
    Goran
    http://108obiee.blogspot.com

Maybe you are looking for

  • Firefox tabs combining

    When I use Firefox I tend to open a lot of tabs. But when I go to close tabs they all go, except when I get down to three tabs and close the third tab, the remaining two tabs combine together so that only one of them is visible. To see the other tab

  • Why JRadioButtob.setSelected(boolean) doesn't work?

    I implement an inner class claaes ControlPanel, subclass of JPanel, which have a GroupButton of two JRadioButtons. The state of the JRadioButton will be changed according to the selected item from a JList. My code structure as follow: public MainClas

  • Restoring bkf files in Server 2012

    I am wondering if anyone has found a tool to restore a bkf file in Server 2012. The hotfix released for Server 2008R2 that enables you to restore a backup made using in ntbackup in Server 2003 does not work. I have tested using xcopy which will work

  • Directory services

    I am new beginner in this field. Currently i am working on solaris 10 environment. Can you suggest me or give me any link related to directory services in solaris 10? Means all from basics in directory services in solaris10 . And does directory servi

  • My pictures on iphone have disappeared - under usage in settings i see that pictures should be 8.8GB, but camera roll is empty please help

    This is a weird one - like I said, camera roll is empty, but phone's memory is full. Under usage it shows that  have 8.8 gb worth of photos (which is what it should be approximately). I cannot access the photos from computer as well - under import pi