Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 974

Re: Datatype change of a Column

$
0
0

As mentioned , changing the datatype when you have the data is not prescribed, as it may lead to data corruption.

 

If yours is a Z table, can you please create another Z_DELTA, under your schema and load all the data from that table to Z_DELTA with proper conversion like TO_DECIMAL().

 

--DROP TABLE <YOUR_SCHEMA>.Z_DELTA;
CREATE COLUMN TABLE <YOUR_SCHEMA>.Z_DELTA 
AS ( 
 select top 10 TO_DECIMAL(YOUR_NVARCHAR_FIELD) as YOUR_DECIMAL_FIELD,* from  <SCHEMA_OF_ACTUAL_TABLE>.<TABLE>
); 

and then drop table and Create the same table in schema. Then do the above load with newly created table. then drop the Z_DELTA.

 

 

-Chandan


Viewing all articles
Browse latest Browse all 974

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>