Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. How to create and use Alias Name for the Database

How to create and use Alias Name for the Database

Scheduled Pinned Locked Moved Database
databasehelpquestionannouncementdesign
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    indian143
    wrote on last edited by
    #1

    Hi All, I have a database in Prod as DbX, and its a live database each time we deploy some schema changes on the Database we Post fix the date, which is working good so far. Its good so far, but to not to change the Connection Strings can I alias database with a particular name to keep the Connection String same but inside database they point to the different times different databases according to the newest version. Why we are keeping different versions every time is, if we keep the same name and restore multiple times from local backup then the Server backup we do, the local backup restore is influencing on the Server backup with SQL Safe Backup. So the question is can we have an Alias of the database which points to the different active database for every new release and still can be access from UI with the same Alias name so that UI team doesn't have to change their connection strings for every new release of the database? Any help, a link, a code snippet or even a suggestion would be very very helpful. Thanks in advance.

    Thanks, Abdul Aleem "There is already enough hatred in the world lets spread love, compassion and affection."

    M 1 Reply Last reply
    0
    • I indian143

      Hi All, I have a database in Prod as DbX, and its a live database each time we deploy some schema changes on the Database we Post fix the date, which is working good so far. Its good so far, but to not to change the Connection Strings can I alias database with a particular name to keep the Connection String same but inside database they point to the different times different databases according to the newest version. Why we are keeping different versions every time is, if we keep the same name and restore multiple times from local backup then the Server backup we do, the local backup restore is influencing on the Server backup with SQL Safe Backup. So the question is can we have an Alias of the database which points to the different active database for every new release and still can be access from UI with the same Alias name so that UI team doesn't have to change their connection strings for every new release of the database? Any help, a link, a code snippet or even a suggestion would be very very helpful. Thanks in advance.

      Thanks, Abdul Aleem "There is already enough hatred in the world lets spread love, compassion and affection."

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      You are doing this completely wrong, do it the same as you would do a branch, leave your latest version with the original name and change your archive database name before deploy a new version. Your production database should never change its connection string.

      Never underestimate the power of human stupidity RAH

      I D 2 Replies Last reply
      0
      • M Mycroft Holmes

        You are doing this completely wrong, do it the same as you would do a branch, leave your latest version with the original name and change your archive database name before deploy a new version. Your production database should never change its connection string.

        Never underestimate the power of human stupidity RAH

        I Offline
        I Offline
        indian143
        wrote on last edited by
        #3

        Makes sense thanks man.

        Thanks, Abdul Aleem "There is already enough hatred in the world lets spread love, compassion and affection."

        1 Reply Last reply
        0
        • M Mycroft Holmes

          You are doing this completely wrong, do it the same as you would do a branch, leave your latest version with the original name and change your archive database name before deploy a new version. Your production database should never change its connection string.

          Never underestimate the power of human stupidity RAH

          D Offline
          D Offline
          david_smith01
          wrote on last edited by
          #4

          USE <SYNONYMDB> SELECT '[' + TABLE_NAME + ']', '[' + TABLE_SCHEMA + '].[' + TABLE_NAME + ']', 'IF EXISTS (SELECT * FROM sys.synonyms WHERE name = ''' + TABLE_NAME + ''') DROP SYNONYM ['+ TABLE_NAME + ']; CREATE SYNONYM [' + TABLE_NAME + '] FOR <ORIGINALDB>.' + TABLE_SCHEMA + '.[' + TABLE_NAME + ']' AS SynonymUpdateScript FROM <ORIGINALDB>.INFORMATION_SCHEMA.TABLES ................................. parse migration service

          M 1 Reply Last reply
          0
          • D david_smith01

            USE <SYNONYMDB> SELECT '[' + TABLE_NAME + ']', '[' + TABLE_SCHEMA + '].[' + TABLE_NAME + ']', 'IF EXISTS (SELECT * FROM sys.synonyms WHERE name = ''' + TABLE_NAME + ''') DROP SYNONYM ['+ TABLE_NAME + ']; CREATE SYNONYM [' + TABLE_NAME + '] FOR <ORIGINALDB>.' + TABLE_SCHEMA + '.[' + TABLE_NAME + ']' AS SynonymUpdateScript FROM <ORIGINALDB>.INFORMATION_SCHEMA.TABLES ................................. parse migration service

            M Offline
            M Offline
            Mycroft Holmes
            wrote on last edited by
            #5

            And you are telling me this for a reason!!! Also while the answer is technically correct it is the wrong solution, the archives need to be changed but the production database.

            Never underestimate the power of human stupidity RAH

            Richard DeemingR 1 Reply Last reply
            0
            • M Mycroft Holmes

              And you are telling me this for a reason!!! Also while the answer is technically correct it is the wrong solution, the archives need to be changed but the production database.

              Never underestimate the power of human stupidity RAH

              Richard DeemingR Online
              Richard DeemingR Online
              Richard Deeming
              wrote on last edited by
              #6

              Notice the site-driving spam link at the bottom of the message. :doh:


              "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

              "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups