Home > 2007, SharePoint > SQL Aliasing within SharePoint

SQL Aliasing within SharePoint

As I recently heard about SQL Aliasing I tried to figure out how it all works. There is a nice post by Thomas Vochten on the subject on how to set it up :

Things to take into account :
SQL Aliasing is NOT configured on the SQL Server, it is configured on every server of your SharePoint Farm.
If you want to add servers to an already existing farm and you can’t find any documentation on the aliases, just go to one of the servers in the farm and run cliconfg.exe.
The advantage of this approach is that if you ever want to move your SharePoint databases to a new SQL Server all you need to do is change the SQL Alias.

Categories: 2007, SharePoint Tags: , , ,
  1. Bala
    April 20, 2012 at 11:54 pm

    SQL Alias

    You can give a table or a column another name by using an alias. This can be a good thing to do if you have very long or complex table names or column names.

    An alias name could be anything, but usually it is short.
    SQL Alias Syntax for Tables
    SELECT column_name(s)
    FROM table_name
    AS alias_name
    SQL Alias Syntax for Columns
    SELECT column_name AS alias_name
    FROM table_name

    Alias Example

    Assume we have a table called “Persons” and another table called “Product_Orders”. We will give the table aliases of “p” and “po” respectively.

    Now we want to list all the orders that “Ola Hansen” is responsible for.

    We use the following SELECT statement:
    SELECT po.OrderID, p.LastName, p.FirstName
    FROM Persons AS p,
    Product_Orders AS po
    WHERE p.LastName=’Hansen’ AND p.FirstName=’Ola’

    The same SELECT statement without aliases:
    SELECT Product_Orders.OrderID, Persons.LastName, Persons.FirstName
    FROM Persons,
    WHERE Persons.LastName=’Hansen’ AND Persons.FirstName=’Ola’

    As you’ll see from the two SELECT statements above; aliases can make queries easier to both write and to read.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: