How to update the identity_column value in sql server 2008

Hi Team,
I have identity column based table. In the table i use insert the name as per the requirement and for ID i use to set the identity now i need to update the particular row id.
when i use to trying i'm getting the below error.
Msg 8102, Level 16, State 1, Line 4
Cannot update identity column 'CategoryID'.
Kindly help me out regarding this.
Thanks & Regards,
Ramesh R

You cannot update an IDENTITY column. You need to move the data into another table make  the changes over there  and insert the back the data into original table.
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

Similar Messages

  • How to update the table value in the valuechange event?

    I have an input field in the datatable with the valueChangeListener
    <rich:dataTable id="cart" value="#{cart.cartList}" var="item">
    <h:inputText value="#{item.cost}" id="qty" valueChangeListener="#{items.updateCost}" onchange="submit()">
    <h:outputText value="#{item.errorMsg}"> </h:outputText>
    in the backing bean
         Item item = (Item) model.getRowData();
    // do some update, if the cost too larger, change to max_cost
         item.setCost(max_cost);
         item.setErrorMsg("Error Msg");
    After calling the valuechange method, the screen output doesn't update the cost.
    How to update the table value in the valuechange event?

    As you're misusing the valueChangeListener to set another input field, you need to skip the update model values phase. Otherwise the value set in the valueChangeListener will be overridden by the submitted value. You can do this by calling the FacesContext#renderResponse() inside the valueChangeListener method. This will shift the current phase immediately to the render response phase, hereby skipping the update model values and invoke application phases.

  • How to restore the Password backup in sql server 2005

    How to restore the Password backup in sql server 2005

    Hello,
    THANKS............ BUT
    I executed this query 
    RESTORE DATABASE new_data1
    FROM DISK = 'd:\UK_DETAILS.bak'
    with password ='selfinity123'
    WITH MOVE 'UK_DETAILS.bak' TO 'D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\new_data1.mdf',
    MOVE 'UK_DETAILS.bak' TO 'D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\new_data1.ldf'
    I got the error 
    Msg 319, Level 15, State 1, Line 4
    Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon.

  • How to convert rows to columns in sql server 2008

    How to convert rows to columns in sql server 2008 using the GROUP BY function? (only one query allowed)

    Lookup the Pivot transformation. From BOL:
    The Pivot transformation makes a normalized data set into a less normalized
    but more compact version by pivoting the input data on a column value. For
    example, a normalized Orders data set that lists customer name, product, and quantity purchased typically has multiple rows for any customer who purchased multiple products, with each row for that customer showing order
    details for a different product. By pivoting the data set on the product column, the Pivot transformation can output a data set with a
    single row per customer. That single row lists all the purchases by the customer, with the product names shown as column names, and the quantity shown as a value in the product column. Because not every customer purchases every product, many columns may contain
    null values.
    When a dataset is pivoted, input columns perform different roles in the pivoting process. A column can participate in the following ways:
    The column is passed through unchanged to the output. Because many input rows
    can result only in one output row, the transformation copies only the first
    input value for the column.
    The column acts as the key or part of the key that identifies a set of
    records.
    The column defines the pivot. The values in this column are associated with
    columns in the pivoted dataset.
    The column contains values that are placed in the columns that the pivot
    creates.
    Paul

  • Cannot open database " " requested by the login. The login failed. SQL Server 2008 Express

    I am getting this message when I try to create a path to a work file from my application.
    Cannot open database " " requested by the login.  The login failed. 
    SQL Server 2008 is installed.  I have placed the computer name and instance in the application's config file as connection source. 
    The database is also not showing up in SQl Server Management Studio in list of databases.
    Thanks.

    Hello,
    Can you please confirm login exist in the sql server and its mapped to particular database.
    Are you directly connecting to SSMS?
    Or using any 4 part query?
    Please share how you are accessing the DB and screen hots of error messages.
    Thank You.
    Regards, Pradyothana DP. Please Mark This As Answer if it solved your issue. Please Mark This As Helpful if it helps to solve your issue. ========================================================== http://www.dbainhouse.blogspot.in/

  • Will the reports developed in sql server 2008 r2 BIDS work when deployed on sql server 2012 reporting manager

    Will the reports developed in sql server 2008 r2 BIDS work when deployed on sql server 2012 reporting manager?
    when I check on Microsoft site it says
    Reports are not upgraded when you upload a report definition file directly to the report server
    or SharePoint site. Upgrading a report definition in SQL Server Data Tools is the only way to upgrade the .rdl file.
    When you open an .rdl file in Report Designer in SQL Server Data Tools (SSDT), if the report was
    created for a previous namespace, Report Designer automatically creates a backup file and upgrades the report to the current namespace.
    This is the only way you can upgrade a report definition file.
    Now here is another confusing statement which says
    You can upload an .rdl file created in an earlier version of Reporting Services to a SQL Server
    2012 report server and it is automatically upgraded on first use. The report server stores the report definition file in the original format. The report is automatically upgraded the first time it is viewed, but the stored report definition file remains
    unchanged.
    All I want to know is if I deploy a rdl made in 2008 r2 to 2012 will it work on the report manager of
    2012?
    <o:p>
    </o:p>
    Mudassar

    I have tested this fucntionality and can confirm that ssrs 2008 r2 reports work when you deploy them on new ssrs 2012 report manager .
    No Migration is required .
    I didnt even moved report server dbs .All I did is just deployed reports on the report manager and it worked .
    "You
    can upload an .rdl file created in an earlier version of Reporting Services to a SQL Server 2012 report server and it is automatically upgraded on first use. "
    Microsoft needs to correct this the documentation is misleading
    Mudassar

  • How to add the zorin os and domain server 2008

    Since Zorin is just a flavour of Ubuntu you should be able to use any of the guides for adding Ubuntu to Active Directory. You can use Samba, Winbind, LikewiseOpen or another package to add it.
    Here is some more information: http://askubuntu.com/questions/33592/how-do-i-join-a-windows-active-directory.

    how to add the zorin os and domain server 2008
    kindly help as 
    This topic first appeared in the Spiceworks Community

  • Very Urgent.......How to update the database values through OAF pages ??

    Hi All,
    I am developeing some self service application thru Oracle Application Framework(OAF). There I am fetching 5 attributes from the database and displaying those attributes in my main page Table Region. Now my requirement is i want to edit that exising values & again i want to store it in the databse while clicking the update button. so first i have created one VO for fetching the values from the database & i make one Table Region in my main page along with 5 MessageTextInput field.. & i mapped that VO's attributes to my textbox.Now i can able to fetch & display the values inside the text box while rendering the page.
    But I dont know how to update the values in the database. Caz in my VO I have only select query. So anyone plz send me the code for update. And also plz let me know where to insert that code..whether (CO or AM or EO)..it is very urgent.
    Thanks
    srini

    David,
    Note that the default JavaBean datacontrol does not allow create/remove and transaction operations. These apis are not implemented for the JavaBean datacontrol.
    You may re-initialize the rowsetiterator, by calling ((oracle.adf.model.generic.DCRowSetIteratorImpl)iteratorBinding.getRowSetIterator()).clearCurrentData().
    This will force the RSI to refresh it's data via the named-accessor again.

  • How to access the MDX application from SQL server when working with OBIEE?

    Hi,
    I am new to MS SQL Server 2005. We have developed the OLAP Cubes on SQL Server Business Intelligence Development Studio with its integration with Oracle Business Intelligence Enterprise Edition (OBIEE).
    The backend query is in MDX language. Now if I need to run that query I need to access the MDX Application, rite?
    So need to know how to connect to MDX application.
    Regards,

    Administration Tool: File - Import - "from multidimensional". There you choose "Provider Type" = "Analysis Server 2005". You specify the URL, user name and password. Then you can import MSAS cubes just like Essbase ones.
    Cheers

  • How to access the MDX application from SQL server?

    Hi,
    I am new to MS SQL Server 2005. We have developed the OLAP Cubes on SQL Server Business Intelligence Development Studio with its integration with Oracle Business Intelligence Enterprise Edition (OBIEE).
    The backend query is in MDX language. Now if I need to run that query I need to access the MDX Application, rite?
    So need to know how to connect to MDX application.
    Regards,

    I think that you have posted this query to the wrong forum. Try this one:
    Business Intelligence Suite Enterprise Edition
    --Andy                                                                                                                                                                                                                                                                                           

  • Identity seed at the subscriber changes automatically (SQL Server 2008 R2 SP2 CU9).

    Hi all,
    I have and updateable transactional subscription. The identity seed at subscriber for a table changed (I don't know how) and caused next inserts generate duplicate PKs. I manually reseeded (using DBCC CHECKIDENT) its identity column to upper value to prevent
    duplicates. But after 5 seconds it is automatically reseeded to lower value. I repeated reseed command but again after sync with publisher it changed to lower value. How can I solve this problem?
    Any help would be greatly appreciated.
    Leila

    It is possible in this case that you are not syncing frequently enough, or that you are doing more than 2000 inserts on the subscriber between sync's. In this case you will need to change your subscriber identity range.
    Right click on your publication, select properties, then in the articles tab, locate your table, click on article properties, and select set properties of highlighted table article, in the identity range management section , set subscriber range size to
    some value like 2000 or 10000. 2000 will allow up to 4000 subscriber side inserts between syncs, and 10000 will allow 20,000 inserts on the subscriber.
    looking for a book on SQL Server 2008 Administration?
    http://www.amazon.com/Microsoft-Server-2008-Management-Administration/dp/067233044X looking for a book on SQL Server 2008 Full-Text Search?
    http://www.amazon.com/Pro-Full-Text-Search-Server-2008/dp/1430215941

  • How to write a store procedure under SQL Server 2008

    Hi Folks,
    Kindly help me step by step how to create a simple store procedure with help of sql server 2008 r2 for Crystal report.
    I know how to work by using Universe but not SQL Server. Kindly help me how to hard code by using sql.
    Thanks in adv.
    Reddy

    For the actual syntax for programming the stored proc, you'll need to work with someone (or a website) who knows T-SQL.
    The cursor that gets returned from the stored proc must be an "in out" parameter for the stored proc.  For SQL Server I usually define a record type that includes the fields that will be returned and then return a set of records of that type.  Again, check with someone who is familiar with T-SQL for more information about how to do this.
    -Dell

  • How to connect from Oracle 11g to SQL Server 2008 R2

    Hi,
    Is it possible to connect from Oracle 11g on AIX to SQL Server 2008 R2? If so, what is the preferred method?
    SQL Server has the original table. From Oracle 11g, we want to access data which is in SQL Server real time.
    Thank You
    Sarayu

    Hi,
    Have a look at these Oracle notes for the full information on the gateways -
    Master Note for Oracle Gateway Products (Doc ID 1083703.1)
    Functional Differences Between DG4ODBC and Specific Database Gateways (Doc ID 252364.1)
    Gateway and Generic Connectivity Licensing Considerations (Doc ID 232482.1)
    How to Setup DG4MSQL (Oracle Database Gateway for MS SQL Server) 64bit Unix OS (Linux, Solaris, AIX,HP-UX) (Doc ID 562509.1)
    How to Configure DG4ODBC on 64bit Unix OS (Linux, Solaris, AIX, HP-UX Itanium) to Connect to Non-Oracle Databases Post Install (Doc ID 561033.1)
    The Database Gateway for SQL*Server (DG4MSQL) needs a separate license but the Database Gateway for ODBC (DG4ODBC) is included in your RDBMS license. You only need to provide the third party ODBC driver needed by DG4ODBC.
    Regards,
    Mike

  • How can this encoding be saved in SQL Server 2008

    hi all,
    We are using Sql Server 2008, it has this collation set "SQL_Latin1_General_CP1_CI_AS". Please have a look at this file:
    https://drive.google.com/file/d/0BxWAyvJA9ZjCdkFNN3BXZUw3dEE/view?pli=1
    its a text file in text format (ascii test data format aka ATDF). Its coming from French vendor and it contains some French words. We have to parse this and upload data to sql server. We do that all the time except this file is not working. It just disturbs
    the way sql server is saving data for us, and upon showing this saved data on application UI, the correct letters don't display. The upload happens via the Bulk Insert command. Please guide as to where to start. Also please let me know exactly what this format
    is called, do we call it just unicodes, or some utf formats. I'm really ignorant when it comes to unicode. Thanks a lot!
    ..ab
    Ab

    Hi
    Please use Unicode data types on the SQL Server side. Please see the following document:
    http://msdn.microsoft.com/en-us/library/ms187828(v=SQL.105).aspx 
    Thanks
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

  • Creating New db(with new name) with the old db backup sql server 2008

    Friends..
    version: Sql Server 2008
    I have a database in a name college1 (more than 200 tables and view etc...)
    i want to create a new db with all the structures including the data of the above db college1 with a new name college2
    so...i finished the step 1 successfully.. what are the other steps i have to do...like validating the invalid objects. etc....
    Step 1:
    RESTORE DATABASE college2 FROM DISK = 'D:\DailyDBbackup\college1.bak'
      WITH replace,
      move 'college2 ' TO 'D:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\college2 .mdf',
      move  'college2 _log' TO 'D:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\college2 _log.ldf';
    step 2: ?
    Step 3: ?
    thanks...

    but...when i type
    use college1
    select * from (it will display all tables under the above db)
    but when i do..
    use college2
    select * from (only system tables are displaying..)
    Did restore completed successfully ? If yes Expand database , can you see tables in the new database you restored ?. Sometimes when you type incorrect word which does not matches anything you wont get help from intellicense you should not be worried about this
    if tables are there in new database college 2
    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 Wiki Article
    MVP

Maybe you are looking for

  • My ipad gets a black bar over part of the screen then freezes up, please help

    Just today my 16gb ipad 2 ,bought in December 2011, started to get a black bar over part of the screen.  Sometimes 3/4 of the screen sometimes 1/4 then it freezes up and will not do anything.  If I try to reboot it I get a faint backlit only.  Any he

  • FLASH PROBLEM IN N73

    hello guyz.howz the day? well i have a serious problem with my N73, when i record any video my flash comes on. and i tried every thing to turn it off but nothing happened. and it surely consuming my battery life too. plzzz can any one let me know how

  • Awt.image writing to mysql

    I am trying to write an Image datatype to a mysql database. The problem is that all the tutorials and books tell you how to do this directly from a file then get a filestream etc etc. I am working on the server side of a system so the image wont have

  • Commercial Printing with images bleeding to the edge

    I have produced an A4 tri-fold flyer with images that "bleed" to the edge. I exported the document as a PDF file (Best quality) and copied it to a CD. My printer said it was fine apart from the image which they normally receive bigger than A4 and ble

  • Pulling text from a .txt to a scroll pane or text area

    Hi- I'm sure there's a way to do this, but I'm not exactly fluent in ActionScript. Basically, my whole website's going to be in Flash, but I want to be able to update one page (sort of a news/blog page) without having to edit the Flash file every tim