Altering Collumn Values and data type properties (SQL Server 2005)

Posted on 2006-04-05
Last Modified: 2008-02-01
I have undertaken a Data Warehousing project. I am using the SQL Server Business Intelligence 2005 and Visual Studio 2005 to achieve my goals.

As of now, I have managed to extract data from a few flat files and loaded them in a relational table by mapping collumns from the flat files to the output table.

I have the following questions:

1) How do you update a certain collumn with new values by replacing the old ones simply by referencing the specific row numbers that I can visually see. For example I would like to replace all values from the collumn "name" and row number 1-23 with "Barry". Can this be done using a simple SQL "Update" statement.

2) Can I alter the properties of a collumn. For example, I would like change the data type of collumn from VARCHAR(50) to integer, decimal or float.

3) Can I use regular expressions in SQL statements to change the structure of data within certain collumns. This is a transformation process.

If you are getting a drift of what I am trying to accomplish from the above description, please feel free to suggest better and more efficient ways to accomplish the same task. However, I would like to accomplish everything within the SQL Server Business Intelligence tool 2005 and Visual Studio 2005 environment.


Question by:scarface7
    1 Comment
    LVL 18

    Accepted Solution

    1) Have a look at Row_Number(). Note that this is a Bad Idea.

    2) Alter Table ... Alter Column ... Int / Dec / Float


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
    JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
    This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
    Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now