Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Browse by Tags · View All
sql_server 217
t-sql 211
tsql 116
sqlserver 96
BRH 78
#SQLServer 66
#TSQL 56
SQL Server 34
function 11
SSMS 9

Archive · View All
August 2007 17
August 2010 8
June 2012 7
June 2011 7
November 2007 7
August 2012 6
May 2012 6
November 2011 6
August 2011 6
October 2011 6

Madhivanan's TSQL Blog

Will altering a datatype cause change in column values?

Apr 27 2011 2:45AM by Madhivanan   

You can change the datatype of the column with ALTER statement. You may think that it will never change the column values. But there are some cases where altering a datatype can cause changing the value of the column. Consider the following table

create table test(id int, dates varchar(100))

insert into test
select 1,'' union all
select 2,'' union all
select 3,null

select * from test 

The result is

id          dates
----------- ------------
1           
2           
3           NULL

Now alter the datatype of the column dates to datetime

alter table test alter column dates datetime 

Run the select statement and see the result

 
select * from test

id          dates
----------- -----------------------
1           1900-01-01 00:00:00.000
2           1900-01-01 00:00:00.000
3           NULL

As you see the empty values are chaged to default value of Jan 01, 1900. Because empty strings are converted to the default values when the datatype is INT, DATETIME, BIGINT stc. You can see more examples in the following post too
http://beyondrelational.com/blogs/madhivanan/archive/2008/09/02/empty-string-and-default-values.aspx

Tags: t-sql, sql_server, default, sqlserver, tsql, BRH, DataTypes,


Madhivanan
3 · 40% · 12936
1
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

Your Comment


Sign Up or Login to post a comment.

"Will altering a datatype cause change in column values?" rated 5 out of 5 by 1 readers
Will altering a datatype cause change in column values? , 5.0 out of 5 based on 1 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]