Showing posts with label columns. Show all posts
Showing posts with label columns. Show all posts

Tuesday, March 20, 2012

Approach Help to load Data from Flatfiles into relational table where Data is coming as spaces i

Hi ,

My Input is a flat file source and it has spaces in few columns in the data . These columns are linked to another table as a foreign key and when i try loading them in a relational structure Foreigh key violation is occuring , is there a standard method to replace these spaces .

what approach should i take so that data gets loaded in a relational structure.

for example

Name Age Salary Address

dsds 23 fghghgh

Salary description level

2345 nnncncn 4

here salary is used in this example , the datatype is char in real scenario

what approach should i take to load the data in with cleansing the spaces in ssis

Assumption: You don't have any control over the structure of the destination tables, but you can add records.

To maintain your foreign key constraint, you will need to create a "salary" record that you can use where salary is not defined. EG:

Salary Description Level

9999 Not Assigned 1

Then you can use a Derived Column expression to create a new column in your dataset that uses an If expression and then write that derived column to your destination table

Like this:

Code Snippet

[Salary]=="" ? 9999 : [Salary]

This is not an optimal solution (even though it is very practical.) Ideally you should restructure your tables so:

Assumption: You can change the structure of your destination tables

In this case, you need to take the Salary column out of your destination table, and put it into another table. The relationship is that employees can have zero or one salary code. So you can create a table relating employees to salary codes with two columns (EmployeeNumber, SalaryCode) and a primary key on EmployeeCode.

(This is a drastic simplification, of course. In a real-world scenario you would probably want to track historical information too.)

|||

Thanks for the Quick reply i tried doing as you said using derived transformation and using replace function but it doesnot seem to capture the space as value in the replace expression in ssis.

Replace(salary," ",9999) it does not work it says that there might be a possibility of divide by zero error. what expression should i use here to replace the values

|||

first of all, since this is a char value, you should put quotes around the 9999.

Seond, I didn't say to use the REPLACE function, though I guess that would work, but you run the risk of having a valid id messed up by replacing a leading or trailing space with a 9999.

Also, if your Salary code was " " (eight spaces) then the REPLACE function will put in:

"99999999999999999999999999999999" which migh be too big for your destination field.

So, try using TRIM first to get ris of spaces, then ?: to replace blank with 9999.

Put this into the Expression column of Derived Value step:

Code Snippet

TRIM([SALARY])=="" ? "9999" : TRIM([Salary])

sql

Applying the default collation sequence

How can I apply to the all database tables columns the default collation
sequence for the database ?Hi
If you have changed the database collation then you can use
http://tinyurl.com/lpj7k
John
"Alur" wrote:

> How can I apply to the all database tables columns the default collation
> sequence for the database ?|||Thank you very much indeed.
"John Bell" wrote:
[vbcol=seagreen]
> Hi
> If you have changed the database collation then you can use
> http://tinyurl.com/lpj7k
> John
> "Alur" wrote:
>

Applying the default collation sequence

How can I apply to the all database tables columns the default collation
sequence for the database ?Hi
If you have changed the database collation then you can use
http://tinyurl.com/lpj7k
John
"Alur" wrote:
> How can I apply to the all database tables columns the default collation
> sequence for the database ?|||Thank you very much indeed.
"John Bell" wrote:
> Hi
> If you have changed the database collation then you can use
> http://tinyurl.com/lpj7k
> John
> "Alur" wrote:
> > How can I apply to the all database tables columns the default collation
> > sequence for the database ?

Sunday, February 19, 2012

Appending columns - horizantal dimention

Hi,
There are two queries as follow:
Original Query Result
select * from Customers
CustomerId Name OrderId
--
11 Mike 101
22 James 102
select * from OrderDetails
OrderId Product Quantity
---
101 100w speaker 1
101 Headphone 2
102 Blank CDs 1
I know this is an unusual approach to merge two result sets like below, but
what is the best way of getting the following result from the those two
queries above:
CustomerId Name OrderId Product Quantity Product
Quantity
----
--
11 Mike 101 100w speaker 1 Headphone 2
22 James 102 Blank CDs 1
Any query sample or suggestion will be appreciated.
Thanks
MehdiSelect *.C, *.OD
FROM Customers C(NOLOCK)
JOIN OrderDetails OD(NOLOCK) ON C.OrderID = OD.OrderID
Just my twist on it,
Adam Turner
"Mehdi" wrote:

> Hi,
> There are two queries as follow:
> Original Query Result
>
> select * from Customers
> CustomerId Name OrderId
> --
> 11 Mike 101
> 22 James 102
>
> select * from OrderDetails
> OrderId Product Quantity
> ---
> 101 100w speaker 1
> 101 Headphone 2
> 102 Blank CDs 1
>
> I know this is an unusual approach to merge two result sets like below, bu
t
> what is the best way of getting the following result from the those two
> queries above:
>
> CustomerId Name OrderId Product Quantity Product
> Quantity
> ----
--
> 11 Mike 101 100w speaker 1 Headphone
2
> 22 James 102 Blank CDs 1
>
> Any query sample or suggestion will be appreciated.
>
> Thanks
>
> Mehdi
>
>|||SELECT C.*, OD.*
FROM Customers C(NOLOCK)
JOIN OrderDetails OD(NOLOCK) ON C.OrderID = OD.OrderID
Just my twist on it,
Adam Turner
"Mehdi" wrote:

> Hi,
> There are two queries as follow:
> Original Query Result
>
> select * from Customers
> CustomerId Name OrderId
> --
> 11 Mike 101
> 22 James 102
>
> select * from OrderDetails
> OrderId Product Quantity
> ---
> 101 100w speaker 1
> 101 Headphone 2
> 102 Blank CDs 1
>
> I know this is an unusual approach to merge two result sets like below, bu
t
> what is the best way of getting the following result from the those two
> queries above:
>
> CustomerId Name OrderId Product Quantity Product
> Quantity
> ----
--
> 11 Mike 101 100w speaker 1 Headphone
2
> 22 James 102 Blank CDs 1
>
> Any query sample or suggestion will be appreciated.
>
> Thanks
>
> Mehdi
>
>|||Hi Adam,
Thanks for the reply, however you query is a simple join that gets the
results in vertical dimention.
I think I need some sort of a loop to create and append the columns from the
second result. I will post the final query to the group as soon as I find
a solution.
Thanks
Mehdi
"Adam Turner" <AdamTurner@.discussions.microsoft.com> wrote in message
news:DA06C785-1F8A-495A-B6B2-8FAB46D7B33A@.microsoft.com...
> SELECT C.*, OD.*
> FROM Customers C(NOLOCK)
> JOIN OrderDetails OD(NOLOCK) ON C.OrderID = OD.OrderID
> Just my twist on it,
> Adam Turner
> "Mehdi" wrote:
>|||On Tue, 13 Dec 2005 01:14:23 -0000, Mehdi wrote:

>Hi,
>There are two queries as follow:
>Original Query Result
>
>select * from Customers
>CustomerId Name OrderId
>--
>11 Mike 101
>22 James 102
>
>select * from OrderDetails
>OrderId Product Quantity
>---
>101 100w speaker 1
>101 Headphone 2
>102 Blank CDs 1
>
>I know this is an unusual approach to merge two result sets like below, but
>what is the best way of getting the following result from the those two
>queries above:
>
>CustomerId Name OrderId Product Quantity Product
>Quantity
>----
--
>11 Mike 101 100w speaker 1 Headphone 2
>22 James 102 Blank CDs 1
>
>Any query sample or suggestion will be appreciated.
Hi Mehdi,
Try if this works:
SELECT Der1.CustomerID, Der1.Name, Der1.OrderId,
Der1.Product, Der1.Quantity, Der2.Product, Der2.Quantity
FROM (SELECT a.CustomerID, a.Name, a.OrderId,
b.Product, b.Quantity, COUNT(*) AS Rank
FROM Customers AS a
INNER JOIN orderDetails AS b
ON b.OrderId = a.OrderId
INNER JOIN orderDetails AS c
ON c.OrderId = b.OrderId
AND c.Product <= b.Product
GROUP BY a.CustomerID, a.Name, a.OrderId,
b.Product, b.Quantity) AS Der1
LEFT JOIN (SELECT a.CustomerID, a.Name, a.OrderId,
b.Product, b.Quantity COUNT(*) AS Rank
FROM Customers AS a
INNER JOIN orderDetails AS b
ON b.OrderId = a.OrderId
INNER JOIN orderDetails AS c
ON c.OrderId = b.OrderId
AND c.Product <= b.Product
GROUP BY a.CustomerID, a.Name, a.OrderId,
b.Product, b.Quantity) AS Der2
ON Der2.CustomerID = Der1.CustomerID
AND Der2.Rank = Der1.Rank + 1
WHERE Der1.Rank % 2 = 1
(untested - see www.aspfaq.com/5006 if you prefer a testede reply)
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||Hugo,
Thanks for the advise, I havn't tried it yet, but I think it will work as
long as my number of columns are fixed. I have decided to manipulate the
dataset outside SQL using C# code to generate a new dataset based on number
of required number of columns as they are dynamic and change.
Thanks again.
Mehdi|||"Hugo Kornelis" <hugo@.pe_NO_rFact.in_SPAM_fo> wrote in message
news:froup1pla55vvh2tkf11i00cr528d70m65@.
4ax.com...
> On Tue, 13 Dec 2005 01:14:23 -0000, Mehdi wrote:
>
but
>----
--
2
> Hi Mehdi,
> Try if this works:
> SELECT Der1.CustomerID, Der1.Name, Der1.OrderId,
> Der1.Product, Der1.Quantity, Der2.Product, Der2.Quantity
> FROM (SELECT a.CustomerID, a.Name, a.OrderId,
> b.Product, b.Quantity, COUNT(*) AS Rank
> FROM Customers AS a
> INNER JOIN orderDetails AS b
> ON b.OrderId = a.OrderId
> INNER JOIN orderDetails AS c
> ON c.OrderId = b.OrderId
> AND c.Product <= b.Product
> GROUP BY a.CustomerID, a.Name, a.OrderId,
> b.Product, b.Quantity) AS Der1
> LEFT JOIN (SELECT a.CustomerID, a.Name, a.OrderId,
> b.Product, b.Quantity COUNT(*) AS Rank
> FROM Customers AS a
> INNER JOIN orderDetails AS b
> ON b.OrderId = a.OrderId
> INNER JOIN orderDetails AS c
> ON c.OrderId = b.OrderId
> AND c.Product <= b.Product
> GROUP BY a.CustomerID, a.Name, a.OrderId,
> b.Product, b.Quantity) AS Der2
> ON Der2.CustomerID = Der1.CustomerID
> AND Der2.Rank = Der1.Rank + 1
> WHERE Der1.Rank % 2 = 1
Ugggh....
Have you forgotten about RAC :)
www.rac4sql.net

appending a temporary table to another temporary table

I need to append one table to another. The fields/columns headings are
identical in both tables. How do I append one to the other using SQL (in
Query Analyzer)?Hi Mitch
Try something like this:
INSERT INTO #temptable1
SELECT * FROM #temptable2
HTH
Kalen Delaney, SQL Server MVP
www.solidqualitylearning.com
"Mitch" <Mitch@.discussions.microsoft.com> wrote in message
news:A0D31075-F452-4DF5-B78A-AA9482992986@.microsoft.com...
>I need to append one table to another. The fields/columns headings are
> identical in both tables. How do I append one to the other using SQL (in
> Query Analyzer)?
>|||insert into tableA
select * from TableB
http://sqlservercode.blogspot.com/

Thursday, February 16, 2012

Append (?) query

I'm trying to join 8 views (ViewA, ViewB, etc...) together
into one new table. All the views have 3 columns (ID,
result1, result2), as does the destination table. I'm
currently trying this method -
SELECT * INTO [dbo].[ANewTable] FROM [dbo].[ViewA]
SELECT * INTO [dbo].[ANewTable] FROM [dbo].[ViewB]
...etc...
but only ViewA is added to ANewTable and I get the error
message -
'There is already an object named 'ANewTable' in the
database.'
Any advice on how to resolve this would be greatly
appreciated.
Thanks.
1: Do a UNION between the SELECT statements:
SELECT col1, col2, ... FROM ViewA
UNION ALL
SELECT col1, col2, ... FROM ViewB
UNION ALL
SELECT col1, col2, ... FROM ViewC
2. Once that is sorted out and gives correct result, use it as a derived table:
SELECT col1, col2, ...
INTO aNewTable
FROM
(
<the above code goes here>
) AS d
Each SELECT INTO creates a new table, you cannot have several using the same table name. Also, don't
use SELECT *, that is begging for trouble in the future...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"hagglingchad" <anonymous@.discussions.microsoft.com> wrote in message
news:088b01c4a608$d2b2f830$a401280a@.phx.gbl...
> I'm trying to join 8 views (ViewA, ViewB, etc...) together
> into one new table. All the views have 3 columns (ID,
> result1, result2), as does the destination table. I'm
> currently trying this method -
> SELECT * INTO [dbo].[ANewTable] FROM [dbo].[ViewA]
> SELECT * INTO [dbo].[ANewTable] FROM [dbo].[ViewB]
> ...etc...
> but only ViewA is added to ANewTable and I get the error
> message -
> 'There is already an object named 'ANewTable' in the
> database.'
> Any advice on how to resolve this would be greatly
> appreciated.
> Thanks.
|||Tibor,
This is great. Thanks very much. However, I'm not quite
sure of the relevance of 'AS d'.
Chad
>--Original Message--
>1: Do a UNION between the SELECT statements:
>SELECT col1, col2, ... FROM ViewA
>UNION ALL
>SELECT col1, col2, ... FROM ViewB
>UNION ALL
>SELECT col1, col2, ... FROM ViewC
>2. Once that is sorted out and gives correct result, use
it as a derived table:
>SELECT col1, col2, ...
>INTO aNewTable
>FROM
>(
><the above code goes here>
>) AS d
>
>Each SELECT INTO creates a new table, you cannot have
several using the same table name. Also, don't
>use SELECT *, that is begging for trouble in the future...
>--
>Tibor Karaszi, SQL Server MVP
>http://www.karaszi.com/sqlserver/default.asp
>http://www.solidqualitylearning.com/
>
>"hagglingchad" <anonymous@.discussions.microsoft.com>
wrote in message[vbcol=seagreen]
>news:088b01c4a608$d2b2f830$a401280a@.phx.gbl...
together
>
>.
>
|||That is just an alias name for the derived table. Same as in below:
FROM tbla AS a JOIN tblb AS b
For a derived table, you *need* to define such a "correlation" name. Syntax requires it.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"hagglingchad" <anonymous@.discussions.microsoft.com> wrote in message
news:14f401c4a615$b83324a0$a601280a@.phx.gbl...[vbcol=seagreen]
> Tibor,
> This is great. Thanks very much. However, I'm not quite
> sure of the relevance of 'AS d'.
> Chad
> it as a derived table:
> several using the same table name. Also, don't
> wrote in message
> together

Monday, February 13, 2012

Apostrophe in char and varchar columns

HI all,
When trying to insert text into a char or varchar column that contains an
apostrophe ' I get an error message
"the value you entered is not consistant with the datatype or length of the
colum"
I know the length is not a problem, and I'm sure that ' is a char value.
How do I deal with this.
I need to import text type date, not long less thatn 100 char, from anothe
database into an sql table
Thanks
RobertOk figured it out. Makes perfect sense
Thanks
"Robert Bravery" <me@.u.com> wrote in message
news:eBAeJKrLGHA.536@.TK2MSFTNGP09.phx.gbl...
> HI all,
> When trying to insert text into a char or varchar column that contains an
> apostrophe ' I get an error message
> "the value you entered is not consistant with the datatype or length of
the
> colum"
> I know the length is not a problem, and I'm sure that ' is a char value.
> How do I deal with this.
> I need to import text type date, not long less thatn 100 char, from anothe
> database into an sql table
> Thanks
> Robert
>

Sunday, February 12, 2012

Anything wrong with this query?

For a given table, I want to know all the columns that are included in
an index. I have looked on the web and come up with this, which seems
to work, but just wanted some verification. Are there any reasons why
I should be using the metadata functions like OBJECT_NAME?

Thanks
Bruce

SELECT
DISTINCT c.name
from sysusers u,
sysobjects o,
syscolumns c,
sysindexes i,
sysindexkeys k
WHERE o.uid = u.uid
AND u.name = user
AND o.name = 'ing_customer'
AND o.id = i.id
AND i.indid = k.indid
AND OBJECTPROPERTY( i.id, 'IsMSShipped' ) = 0
AND 1 NOT IN ( INDEXPROPERTY( i.id , i.name , 'IsStatistics' ) ,
INDEXPROPERTY( i.id , i.name , 'IsAutoStatistics' ) ,
INDEXPROPERTY( i.id , i.name , 'IsHypothetical' ) )
AND i.indid BETWEEN 1 And 250
AND k.id = o.id
and k.colid = c.colid
and c.id = o.id
ORDER BY c.nameBruce (sandell@.pacbell.net) writes:
> For a given table, I want to know all the columns that are included in
> an index. I have looked on the web and come up with this, which seems
> to work, but just wanted some verification. Are there any reasons why
> I should be using the metadata functions like OBJECT_NAME?

object_name() is just a quick-step to sysobjects.name, which is a
documented column, so which one you use, is no big deal.

On the other hand, the information returned by objectproperty() and
indexproperty() is hidden in undocuemented columns, so in this case,
you should definitely use the metadata functions.

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

Thursday, February 9, 2012

Anything that you find in SQL object scripts, you can also find them in system tables?

I tried all the INFORMATION_SCHEMA on SQL 2000 and
I see that the system tables hold pretty much everything I am
interested in: Objects names (columns, functions, stored procedures, ...)
stored procedure statements in syscomments table.

My questions are:

If you script your whole database everything you end up having
in the text sql scripts, are those also located in the system tables?
That means i could simply read those system tables to get any information
I would normally look in the sql script files?

Can i quickly generate a SQL statement of all the indexes on my database?

I read many places that Microsoft
says not to modify anything in those tables and not query them since their
structure might change in future SQL versions.

Is it safe to use and rely the system tables?

I basically want to do at least fetching of information i want from the
system tables rather than the SQL script files.
I also want to know if it's pretty safe for me to make changes in these
tables.
Can i rename an object name for example an Index name, a Stored Procedure
name?
Can i add a new column in the syscolumns table for a user table?

Thank youThe SQLDMO script method can be used to script any SQL Server object. You
can also generate scripts from Enterprise, Query Analyzer or from the
command line using the scptxfr.exe utility.

> Is it safe to use and rely the system tables?

Yes and no. The INFORMATION_SCHEMA views are a better source for lots of the
metadata and they are usually recommended as the preferred method whenever
possible. However, the information schema doesn't cover everything (no
indexes for example) so you may still need to make use of system tables for
some things. If you rely only on the features documented in Books Online and
avoid referencing the stuff that isn't explained or that's marked as
"reserved" then you should be fairly safe. Be sensible though and don't use
system tables when you don't have to. Check out the "Meta Data Functions"
topic in Books Online for other alternatives.

In SQL Server 2005 the old system tables are superceded by a new set of
views that give you much more comprehensive and convenient view of the
metadata. The old-style system tables are still supported for backwards
compatibility although they aren't being extended to support new features.
In theory, most things will work in 2005 as in 2000 but it's not going to be
100% so assume some things may need to be fixed if and when you upgrade.

> I also want to know if it's pretty safe for me to make changes in these
> tables.

Never. Not if you value the integrity of your server and your database. All
the things you need to do are supported through procs and DDL statements.
That includes renaming objects and adding new columns. Don't mess with
updates against the system tables.

--
David Portas
SQL Server MVP
--|||>> Is it safe to use and rely the system tables?

> Yes and no. The INFORMATION_SCHEMA views are a better source for lots of
> the metadata and they are usually recommended as the preferred method
> whenever possible. However, the information schema doesn't cover
> everything (no indexes for example) so you may still need to make use of
> system tables for some things. If you rely only on the features documented
> in Books Online and avoid referencing the stuff that isn't explained or
> that's marked as "reserved" then you should be fairly safe. Be sensible
> though and don't use system tables when you don't have to. Check out the
> "Meta Data Functions" topic in Books Online for other alternatives.

I started reading about Meta Data last week in SQL Books Online and I
am interested to learn more. However I can only do one thing at a time so
I am trying to understand the system tables first and find out ways
how/when/why I could and should use them.
I'll check out "Meta Data Functions" to see what they do.

>> I also want to know if it's pretty safe for me to make changes in these
>> tables.

> Never. Not if you value the integrity of your server and your database.
> All the things you need to do are supported through procs and DDL
> statements. That includes renaming objects and adding new columns. Don't
> mess with updates against the system tables.

Understood. I won't make any changes in these tables. You are right if I can
use the supported procs and DDL statements then I'll use them.

Thank you|||>> Is it safe to use and rely the system tables?

> Yes and no. The INFORMATION_SCHEMA views are a better source for lots of
> the metadata and they are usually recommended as the preferred method
> whenever possible. However, the information schema doesn't cover
> everything (no indexes for example) so you may still need to make use of
> system tables for some things. If you rely only on the features documented
> in Books Online and avoid referencing the stuff that isn't explained or
> that's marked as "reserved" then you should be fairly safe. Be sensible
> though and don't use system tables when you don't have to. Check out the
> "Meta Data Functions" topic in Books Online for other alternatives.

I started reading about Meta Data last week in SQL Books Online and I
am interested to learn more. However I can only do one thing at a time so
I am trying to understand the system tables first and find out ways
how/when/why I could and should use them.
I'll check out "Meta Data Functions" to see what they do.

>> I also want to know if it's pretty safe for me to make changes in these
>> tables.

> Never. Not if you value the integrity of your server and your database.
> All the things you need to do are supported through procs and DDL
> statements. That includes renaming objects and adding new columns. Don't
> mess with updates against the system tables.

Understood. I won't make any changes in these tables. You are right if I can
use the supported procs and DDL statements then I'll use them.

Thank you|||serge (sergea@.nospam.ehmail.com) writes:
> I tried all the INFORMATION_SCHEMA on SQL 2000 and
> I see that the system tables hold pretty much everything I am
> interested in: Objects names (columns, functions, stored procedures, ...)
> stored procedure statements in syscomments table.
> My questions are:
> If you script your whole database everything you end up having
> in the text sql scripts, are those also located in the system tables?

Scripting does not place anything in system tables. Creating objects
does. The source code of stored procedures, views, functions, constraints
and a few more objects are in syscomments. However, they are stored in
8000 character slices, and non-trivial to decode.

Tables, indexes and user-defined types are not stored as text as such
in SQL Server, but as scattered pieces which the scripting tools
reassemble.

In any case, you should not really script your databases more than at
most once. View the database as a storage for binary objects, and keep
your source code under version control. (But if you started without
version control, you may need to script once to get yourself a baseline.)

> I read many places that Microsoft
> says not to modify anything in those tables and not query them since their
> structure might change in future SQL versions.
> Is it safe to use and rely the system tables?

As David said, there are new means for retrieving meta data in SQL 2005,
and the old system tables in SQL 2005 become views implemented on top
of these, known as "Compatibility views". They are also marked as
deperecated, and they will surely disappear from a future version of
SQL Server, but this is not likely to happen this decade.

Important is to only use documented columns, and only use columns what
they are documented for. A column which has the short description of
"Reserved", will very likely always have a value of 0 or NULL in SQL 2005.

Personally, I use only the system tables for meta-data access in SQL 2000,
and this is also what I recommend. The INFORMATION_SCHEMA views are not
whole-covering, so mixing both means that you must know two paradigms.
There are also some traps with the views which can cause you to not
get data you expect, or columns may have names which makes promises
they don't live up to. SQL Server MVP Tony Rogerson also liks to point
out that they have scalability problems. Finally, all that uppercase
is ugly. :-)

> I basically want to do at least fetching of information i want from the
> system tables rather than the SQL script files.
> I also want to know if it's pretty safe for me to make changes in these
> tables.

Never make changes directly to system tables, unless you are told to so
by a Microsoft support professional.

> Can i rename an object name for example an Index name, a Stored Procedure
> name?

To rename an index use sp_rename. To rename a stored procedure, drop
the procedure and reload it under the new name.

> Can i add a new column in the syscolumns table for a user table?

Absolutely not! You will corrupt your database.

Please keep in mind that there is a whole lot of internal structures
in SQL Server that are not exposed. When you add a column to a table,
SQL Server may need to update all pages in the tables, to create space
for the column. Query plans for procedures that has SELECT * may need
to be flushed etc.

In fact, in SQL 2005, you don't even have read access to the real system
tables. All you see is views.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp