SQL command needed to edit table data

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • News East

    SQL command needed to edit table data

    I have an existing SQL 7 server named HHARBR. HHARBR has a database named
    SPR with a table named "reportname " in it, the table has the name HHARBR
    embedded the table data.

    I migrated the HHARBR database SPR to a second server called HHARBR2. When I
    look into the table in HHARBR2 I still see the name HHARBR in the data.

    What command can I run on HHARBR2 to change the table entries of HHARBR to
    the new server name of HHARBR2?

    I prefer something I can run in the Query Analyzer

    Source server: HHARBR
    Source Database: SPR
    Source Datbase Table: reportname

    Destination Server: HHARBR2
    Destination Databse: SPR
    Destination Table: reportname

    Summary:
    Change wrong server name in destination server to reflect the destinations
    server name


  • Tom Moreau

    #2
    Re: SQL command needed to edit table data

    You didn't give us the column with the reportname table. It'll go something
    like:

    update reportname
    set
    MyCol = 'HHARBR2'
    where
    MyCol = 'HHARBR'

    --
    Tom

    ----------------------------------------------------
    Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
    SQL Server MVP
    Columnist, SQL Server Professional
    Toronto, ON Canada

    ..
    "News East" <Methu969@yahoo .com> wrote in message
    news:cX7Lf.1712 57$WH.96105@duk eread01...
    I have an existing SQL 7 server named HHARBR. HHARBR has a database named
    SPR with a table named "reportname " in it, the table has the name HHARBR
    embedded the table data.

    I migrated the HHARBR database SPR to a second server called HHARBR2. When I
    look into the table in HHARBR2 I still see the name HHARBR in the data.

    What command can I run on HHARBR2 to change the table entries of HHARBR to
    the new server name of HHARBR2?

    I prefer something I can run in the Query Analyzer

    Source server: HHARBR
    Source Database: SPR
    Source Datbase Table: reportname

    Destination Server: HHARBR2
    Destination Databse: SPR
    Destination Table: reportname

    Summary:
    Change wrong server name in destination server to reflect the destinations
    server name


    Comment

    • Erland Sommarskog

      #3
      Re: SQL command needed to edit table data

      News East (Methu969@yahoo .com) writes:[color=blue]
      > I have an existing SQL 7 server named HHARBR. HHARBR has a database named
      > SPR with a table named "reportname " in it, the table has the name HHARBR
      > embedded the table data.
      >
      > I migrated the HHARBR database SPR to a second server called HHARBR2. When[/color]
      I[color=blue]
      > look into the table in HHARBR2 I still see the name HHARBR in the data.
      >
      > What command can I run on HHARBR2 to change the table entries of HHARBR to
      > the new server name of HHARBR2?
      >
      > I prefer something I can run in the Query Analyzer
      >
      > Source server: HHARBR
      > Source Database: SPR
      > Source Datbase Table: reportname
      >
      > Destination Server: HHARBR2
      > Destination Databse: SPR
      > Destination Table: reportname
      >
      > Summary:
      > Change wrong server name in destination server to reflect the destinations
      > server name[/color]

      Rather than having the servername in a table, you could @@servername.
      As a compromise you could change the column to a computed column:

      col AS @@servername


      --
      Erland Sommarskog, SQL Server MVP, esquel@sommarsk og.se

      Books Online for SQL Server 2005 at

      Books Online for SQL Server 2000 at

      Comment

      Working...