Updating Views in sql server

Hi,
I am trying to update a view but the result is 0 row(s) updated
ALTER VIEW vw_AuthorizedStationeries
AS
SELECT StationeryID,
CreatedOn,
StationeryName
FROM dbo.Stationeries
WHERE Authorized = 1
GO
-----------------Update Views-------------------
UPDATE vw_AuthorizedStationeries
SET
CreatedOn = GETDATE()
WHERE
StationeryName = 'StationThree'
GO
What am I doing wrong?
I am trying to update the column 'CreatedOn' with todays date where the row is 'StationThree'.
Is it even possible to what I am trying to do using Views?
Thanks!

Its possible so far as view retrieves a record which satisfies your specified condition ie 
StationeryName = 'StationThree'
You can check if there are records satisfying condition using below query
SELECT COUNT(*)
FROM dbo.Stationeries
WHERE Authorized = 1
AND StationeryName = 'StationThree'
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

Similar Messages

  • How do I create a view in SQL Server in Visual Studio Express 2013 for Desktop?

    Hi
    I've got a SQL Server database set up using the internal SQL Server in Visual Studio Express 2013 for Desktop. I want to create a view (using tables with one to many relationships) but I don't
    know how to do it.
    Where can I find a good tutorial on creating views in SQL Server in Visual Studio Express 2013 for Desktop? I think Visual Studio Express 2013 for Desktop doesn't have some view designer that
    exists in the non-express version of Visual Studio (if I'm not mistaken). So I think I'd need a tutorial on how to do the actual SQL, unless there is some tool I don't know about.
    Thanks

    Hi ,
    According to your description, if you install SQL Server SQL Server 2014 Express and SQL Server Manager Studio tools (SSMS), if you want to create a view, you can use SSMS. Then if you want to connect to and Diagram your SQL Express Database in Visual Studio
    2013, you can attach the database file by using the .NET Framework Data Provider for SQL Server in Visual Studio, and create a database diagram via expanding the “Database Diagrams” node.
     For more information, there is similar issue about how to connect to and Diagram your SQL Express Database in Visual Studio 2012 , you can review the following article,
    http://blogs.msdn.com/b/bethmassi/archive/2011/10/27/how-to-connect-to-and-diagram-your-sql-express-database-in-visual-studio-lightswitch.aspx.
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • Do I need to install Security Hotfix (KB2977319) after Cumulative Update 12 for SQL Server 2008 R2 SP2

    HI,
    I have installed Cumulative Update 12 for SQL Server 2008 R2 SP2 on my SharePoint instances. This was to resolve a known  issue faced with the instance. CU12 helped resolve the issue. My company is rather strict regarding security hotfixes. But I am
    not sure if this particular hotfix [Security Hotfix (KB2977319)] is required if the instance has CU12 applied.
    Tested this on a Lab server, the installation did run fine, the summary log also stated that the KB is applied. But the Build Number did not change. Hence the doubt.
    Overall summary:
      Final result:                  Passed
      Exit code (Decimal):           0
      Exit message:                  Passed
      Start time:                    2014-09-06 10:31:21
      End time:                      2014-09-06 10:55:49
      Requested action:              Patch
    Instance SPNTSQLTRN overall summary:
      Final result:                  Passed
      Exit code (Decimal):           0
      Exit message:                  Passed
      Start time:                    2014-09-06 10:48:08
      End time:                      2014-09-06 10:55:45
      Requested action:              Patch
    Package properties:
      Description:                   SQL Server Database Services 2008 R2
      ProductName:                   SQL2008
      Type:                          RTM
      Version:                       10
      SPLevel:                       2
      KBArticle:                     KB2977319
      KBArticleHyperlink:            http://support.microsoft.com/?kbid=2977319
      PatchType:                     QFE
      AssociatedHotfixBuild:         0
      Platform:                      x64
      PatchLevel:                    10.52.4321.0
      ProductVersion:                10.52.4000.0
      GDRReservedRange:              10.50.4001.0:10.50.4199.0;10.50.4200.0:10.50.4250.0
      PackageName:                   SQLServer2008-KB2977319-x64.exe
      Installation location:         e:\ac2af22d88ee645b5b32b5c178\x64\setup\
    Please inform if I need to apply the hotfix on CU12. Thanks in advance.
    John S

    Yes you must install Security update mentioned in KB 2977319 it is important for SQL Server to be patches with this security update. Without this it could allow an attacker to compromise your system and gain control over it.
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
    My Technet Articles

  • Insert and update tables from SQL server to oracle database tables

    Hi,
    I am having problem while update data from sql server to oracle database tables.
    I am doing one way insert +updates that is from SQL Server tables ==> Oracle database tables
    I am using tools Sql server Integration service. I can insert data from sql server to oracle but update can't. Please help me how can I update + insert from sql server to oracle database tables easily.
    Thanks in advance.

    Hi,
    What about using Oracle SQL Developer for migration
    http://www.oracle.com/technetwork/database/migration/sqlserver-095136.html
    HTH

  • Connecting to datasource and retrieve, insert and update data in SQL Server

    hi,
    i am trying to retrieve, insert and update data from SQL Server 2000 and display in JSPDynPage and is for Portal Application. I have already created datasource in visual composer. Is there any sample codes for mi to use it as reference???
    Thanks
    Regards,
    shixuan

    Hi,
    See this link
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6209b52e-0401-0010-6a9f-d40ec3a09424
    Regards,
    Senthil kumar K.

  • Possible to view MS SQL Server Log in SAP GUI?

    Hi,
    I am wondering if I can view the SQL Server log in SAP GUI using a transaction code.
    I don't readily see how to do this with the TEs.  It would be helpful to see things like: who has tried to log into the SQL Server via a Database Management tool : agnostic to SAP.: is SQL Server Management Studio or DBArtisan or other services.
    thanks
    Chris

    Hi chris
    Yes,you can view the Sql server log in transaction code ST04 & DBA Cockpit in SAPGUI.
    Kindly refer the SAP notes.
    139945 - SAP Database Monitor for MS SQL Server
    1027512 - MSSQL: DBA cockpit for basis release 7.00 and later
    Regards
    Ram

  • Cumulative update 15 for SQL Server 2012 SP1 is released

    Cumulative update 15 for SQL Server 2012 SP1 is released
    http://support.microsoft.com/en-us/kb/3038001
    MDS related fix is:
    FIX: Add three stored procedures to clean up history that is created when you use SQL Server 2012 MDS
    http://support.microsoft.com/en-us/kb/3036601
    After using MDS for a while, the transaction/validation/staging history may grow very large. In this CU we provide 3 store procedure to clean them up manually.
    The fix will be ported over to SQL 2012 SP2 and SQL 2014 CUs in the coming 2 months.
    In next SQL Server release, it will be automated by MDS maintenance job.
    --@ModelID is the model ID that you clean up the log for.
    --@CLeanupOlderThanDate is the date before that the logs or records is deleted.
    DECLARE @CleanupOlderThanDate date = '<Date>', @ModelID INT = <ID>
    --Cleanup Transaction History
    EXEC mdm.udpTransactionsCleanup @ModelID, @CleanupOlderThanDate;
    --Cleanup Validation History
    EXEC mdm.udpValidationsCleanup @ModelID, @CleanupOlderThanDate;
    --Cleanup entity-based staging table
    EXEC mdm.udpEntityStagingBatchTableCleanup @ModelID, @CleanupOlderThanDate;

    Hi SelvaOnline,
    I would recommend to install SP2 and the hotfix that came after it.
    If you don't have a reason to install a CU than don't bother with it.
    SP2:
    http://www.microsoft.com/en-us/download/details.aspx?id=43340
    Hotfix for SP2;
    http://support.microsoft.com/kb/2969896/en-us
    Thanks, 
    Teun

  • Cumulative update 5 for SQL Server 2012 SP2 is released

    Cumulative update 5 for SQL Server 2012 SP2 is released
    https://support.microsoft.com/en-us/kb/3037255
    MDS related fix is:
    FIX: The notification email link is broken when a special character is part of the URL in SQL Server 2012 MDS
    http://support.microsoft.com/en-us/kb/3036201

    Hello,
    The following blog shows the latest builds (updates) available for each version of SQL Server.
    http://sqlserverbuilds.blogspot.com/
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • Can't install the Windows Update package KB2674319 (SQL Server 2012 SP1)

    Hi. I need to get the update of my MS SQL Server 2012 installation in order to get the SP1.
    When I run the Windows Update it appears to download well the package.
    Then when it begins to install  I get the error "84C4000E: Se ha producido un error con Windows Update" (our server is in Spanish).
    I have the last updates for Windows Server, a rebooted our server and the issue remains.
    Any idea of what should I do to get the SP1 update?
    Thanks in advance.
    Gustavo.

    Hi Gustavo,
    Based on your description, I suggest you should refer to the following articles. And then check if you can install the update successfully.
    SQL 2012 Server fails in Windows Update with error 84C4000E
    http://techtuxwords.blogspot.in/2013/10/sql-2012-server-fails-in-windows-update.html
    MS SQL Server 2008 R2 SP1 fails with error 84C4000E
    http://techtuxwords.blogspot.in/2011/09/ms-sql-server-2008-r2-sp1-fails-with.html
    If this issue still persists, please don’t hesitate to let me know.
    Hope this helps.
    Best regards,
    Justin Gu

  • Synatax and Example of Materialized Views in SQL server?

    Syntax and Example of Materialized Views in SQL server?

    Also see
    http://sqlperformance.com/2014/01/sql-plan/indexed-views-and-statistics
    http://www.brentozar.com/archive/2013/11/what-you-can-and-cant-do-with-indexed-views/
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Cumulative Update 1 for SQL Server 2014

    Microsoft has released Cumulative Update #1 for SQL Server 2014. Relevant for @@VERSION 12.0.2000 through 12.0.2341
    http://support.microsoft.com/kb/2931693/en
    [Personal Site] [Blog] [Facebook]

    Shanky,  I did not want to write clearly in the forum, what I think if there are dozens of fixes at bug's level like fails, error messages, crashes, etc.., about three weeks after the release of the production version. but I wrote about it few words
    at facebook Israeli SQL Server User Group. In short.. It's realy look bad in my opinion.
    [Personal Site] [Blog] [Facebook]

  • Update error of SQL Server 2012 enterprise running on Windows server 2008 standard SP2 (32 bits)

    Hi there;
    I have a windows server 2008 SP2 (32bits) in which I have an instance of SQL Server
    2008 and another of 2012.
    My Windows server 2008 installed the following updates; (see below).
    (KB2898858),(KB2909921),(KB890830),(KB2898869),(KB2911502),(KB2901126),
    (KB2916036),(KB2862973),(KB2901113)
    After the machine was re-started, I was not abble to connect
    to the instance of SQL Server 2012.  I am able
    to connect to the instance of SQL Server 2008.
    The error message I get when I atemp to connect can be found
    at the end of the list of updates below.
    Do I need to uninstall an update? if so, which one and how do I do that?
    Thanks        Gabriel I. Ruiz
    Security Update for Microsoft .NET Framework 2.0 SP2 on Windows Vista SP2 and Windows Server 2008 SP2 x86 (KB2898858)
    Installation date: ‎2/‎12/‎2014 11:42 PM
    Installation status: Successful
    Update type: Important
    More information: 
    http://support.microsoft.com/kb/2898858
    Cumulative Security Update for Internet Explorer 9 for Windows Server 2008 (KB2909921)
    Installation date: ‎2/‎12/‎2014 11:42 PM
    Installation status: Successful
    Update type: Important
    More information: 
    http://support.microsoft.com/kb/2909921
    Windows Malicious Software Removal Tool - February 2014 (KB890830)
    Installation date: ‎2/‎12/‎2014 11:41 PM
    Installation status: Successful
    Update type: Important
    More information: 
    http://support.microsoft.com/kb/890830
    Security Update for Microsoft .NET Framework 4.5.1 on Windows 7, Windows Vista and Windows Server 2008 x86 (KB2898869)
    Installation date: ‎2/‎12/‎2014 11:40 PM
    Installation status: Successful
    Update type: Important
    More information: 
    http://support.microsoft.com/kb/2898869
    Security Update for Microsoft .NET Framework 2.0 SP2 on Windows Vista SP2 and Windows Server 2008 SP2 x86 (KB2911502)
    Installation date: ‎2/‎12/‎2014 11:36 PM
    Installation status: Successful
    Update type: Important
    More information: 
    http://support.microsoft.com/kb/2911502
    Security Update for Microsoft .NET Framework 4.5.1 on Windows 7, Windows Vista, and Windows Server 2008 x86 (KB2901126)
    Installation date: ‎2/‎12/‎2014 11:36 PM
    Installation status: Successful
    Update type: Important
    More information: 
    http://support.microsoft.com/kb/2901126
    Security Update for Windows Server 2008 (KB2916036)
    Installation date: ‎2/‎12/‎2014 11:34 PM
    Installation status: Successful
    Update type: Important
    More information: 
    http://support.microsoft.com/kb/2916036
    Security Update for Windows Server 2008 (KB2862973)
    Installation date: ‎2/‎12/‎2014 11:34 PM
    Installation status: Successful
    Update type: Important
    More information: 
    http://support.microsoft.com/kb/2862973
    Security Update for Microsoft .NET Framework 2.0 SP2 on Windows Vista SP2 and Windows Server 2008 SP2 x86 (KB2901113)
    Installation date: ‎2/‎12/‎2014 11:34 PM
    Installation status: Successful
    Update type: Important
    More information: 
    http://support.microsoft.com/kb/2901113
    ===================================
    Cannot connect to HAVANA\HAVANA_2012_1ST.
    ===================================
    The client was unable to establish a connection because of an error during connection initialization process before login. Possible causes include the following:  the client tried to connect to an unsupported version of SQL Server; the server was too busy
    to accept new connections; or there was a resource limitation (insufficient memory or maximum allowed connections) on the server. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.) (.Net SqlClient Data Provider)
    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=233&LinkId=20476
    Server Name: HAVANA\HAVANA_2012_1ST
    Error Number: 233
    Severity: 20
    State: 0
    Program Location:
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
       at System.Data.SqlClient.TdsParserStateObject.SNIWritePacket(SNIHandle handle, SNIPacket packet, UInt32& sniError, Boolean canAccumulate, Boolean callerHasConnectionLock)
       at System.Data.SqlClient.TdsParserStateObject.WriteSni(Boolean canAccumulate)
       at System.Data.SqlClient.TdsParserStateObject.WritePacket(Byte flushMode, Boolean canAccumulate)
       at System.Data.SqlClient.TdsParser.SendPreLoginHandshake(Byte[] instanceName, Boolean encrypt)
       at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover)
       at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover)
       at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer
    timeout)
       at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance)
       at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance,
    SqlConnectionString userConnectionOptions, SessionData reconnectSessionData)
       at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
       at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
       at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
       at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
       at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
       at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
       at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
       at System.Data.SqlClient.SqlConnection.Open()
       at Microsoft.SqlServer.Management.SqlStudio.Explorer.ObjectExplorerService.ValidateConnection(UIConnectionInfo ci, IServerType server)
       at Microsoft.SqlServer.Management.UI.ConnectionDlg.Connector.ConnectionThreadUser()
    ===================================
    No process is on the other end of the pipe

    Hi,
    Check if SQL Server service is running fine. I doubt you may have changed the user account password used for SQL Server service. After restarting the machine, you also need to update the user account of SQL Server service in Configuration
    Manager. Re-type the user account name and password under Log on tab and see how it helps.
    Thanks.
    Tracy Cai
    TechNet Community Support

  • How to get Cumulative Update packages for SQL Server Compact v3.5 SP2 for use on a Windows Mobile device

    There are links on the pages for various Cummulative Updates for SQL Compact v3.5 SP2 which look to relate to the desktop version, but are these also available for Windows Mobile devices?  If so, what is the process to get hold of them?
    We are seeing intermittent problems with corrupted databases on devices which are using SQL Compact v3.5 SP2 and have seen that some of the Cumulative Updates do relate to corruption and would like to see if these can help to solve the issue.

    Just select the KB article, at the top of each there is a link to request a hotfix, you will then get a email with a download link. The 8088 and 8109 hotfixes also apply to Windows Mobile.
    http://erikej.blogspot.dk/2010/08/sql-server-compact-35-sp2-downloadable.html
    Please mark as answer, if this was it. Visit my SQL Server Compact blog http://erikej.blogspot.com

  • SQL Geometry View in SQL Server 2008 R2

    I will preface by saying I'm not an expert on SQL Spatial and am just learning to use the Geometry functions...
    I am an analyst for a county government and am trying to do the following... we have a parcel dataset that has around 100k features and I'm trying to run a view that finds what county supervisor district each polygon is located within.
    If I use the code below I get 2 different values for a parcel where polygons are not coincident.
    polygonA = parcels
    polygonB = supervisor districts
    SHAPE = geometry storage field
    (polygonA.SHAPE.STIntersects(polygonB.SHAPE) = 1)
    If I use the code below on a small set of data, I get the desired results, but if I try to execute this on our entire parcel dataset, SQL Server times out.
    (polygonA.SHAPE.STCentroid().STIntersects(polygonB.SHAPE) = 1)
    We are using SQL Server 2008 R2 with Geometry storage.
    Any advice would be greatly appreciated in how to improve the performance of the query...if possible.

    If I use the code below on a small set of data, I get the desired results, but if I try to execute this on our entire parcel dataset,
    SQL Server times out.
    You could create a
    Spatial Index on your data to improve performance; see
    CREATE SPATIAL INDEX (Transact-SQL)
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Batch Program to update data in SQL Server Environment

    Dear Experts,
    My current scenario is that SAP ECC must send a mass update to an external Data Base (MS SQL Server) in a scheduled Batch Process. The solution that I have thought is:
    Batch Process to go through an ABAP table and to trigger a Web Service that will be provided by this MS SQL Server Database. Depending on the performance, the ABAP program will determine how many registers will be sent making loops of N invokations of the same database Web Service.
    What do you thikng about this? Does anyone of you have a better solution in tearms of data accuracy and performance?
    Thanks a lot for your help,
    toni

    Hmm  create a stored procedure for insert/update /delete and etc and provide a parameter, see example
    CREATE PROCEDURE spInsertNewProduct
    @ProductID INT,
    @ProductName VARCHAR(20)
    AS
    IF NOT EXISTS (SELECT * FROM Products WHERE ProductID=@ProductID )
    INSERT INTO Products  VALUES (@ProductID,@ProductName )
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

Maybe you are looking for