Computed Column

  • Does anyone know how you can edit a computed column on a system table?  I have turned allow updates on but it will not let me edit a computed column.  Any ideas?

     

  • first turn off allow updates then alt-f4.

    Seriouly why would take that chance????

    Why do you need to change this setting?

  • are you sure you didn't mean to say user table instead of system ?!

    also if you don't mind my asking - what table are you trying to update and why ?!







    **ASCII stupid question, get a stupid ANSI !!!**

  • I thought Allow updates must be turned on to make changes?

    We are doing some testing on a development environment with software that needs to modify some dates on the fly to some system tables but I cannot get SQL Server to allow modifications to some computed columns.  When I did as you suggested, Alt-F4 just closes the window.

     

  • To be more specific start and end time of some database maintenance plans/jobs

  • Still, why would you want to risk that, even in testing you can seriously screw up the server with this?

    Why do you need to change the dates?

  • jasmina - please note that -

    The altered column cannot be:

    A computed column or used in a computed column.

    A replicated column....etc..







    **ASCII stupid question, get a stupid ANSI !!!**

  • We are hoping to screw up the test environment to prove that it is not an effective way for the software to make modifications to job/maintenance plan information.  The software is a data logging software for our lab systems and they claim that this is the most effective way and we are trying to prove them wrong.  I know it sounds ridiculous but I need to prove them otherwise.

  • at any rate, it is now a moot point - moo - since it just can't be done...

    i think you should look at other ways of screwing up the test environment

    The tasks that some people have to do...







    **ASCII stupid question, get a stupid ANSI !!!**

  • i think that you can simply tell them that it is the industry standard and also against best practices to modify system tables.

    That should be enough, in my opinion...some things are just not done that way....

    you could argue that it is more "efficient" to directly insert a row in syscolumns to add a new column to a table, rather than running the best practice of an ALTER TABLE ADD COL1... command, but that does not mean it will work as expected.

    put the ball in their court and have them provide documentation that bypassing best practices will not crash the server or affect any other application that uses that server. no documentation would mean no altering of system tables....If the team that suggested this had any real experience with SQL server they would have never proposed something like updating a system table directly.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Jasmina,

    The only way to change the value of a computed column is to change the value in one or more of the columns used to create the computed column expression.

    For example, given the table tbl defined as:

    CREATE TABLE tbl

    (

      int id PRIMARY KEY

    , colB datetime

    , DateAdd(s, 10, tbl.colB) AS colC

    )

    then the only way to change the value of tbl.colC is to change tbl.colB.

     

Viewing 11 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic. Login to reply