开发者

SQL Table- Copying data of different data type tables

开发者 https://www.devze.com 2023-03-16 01:22 出处:网络
I am working on scenario, i have two tables: \"Master_product\" and \"New_Products\" Master_product table have 14 fields

I am working on scenario, i have two tables: "Master_product" and "New_Products"

Master_product table have 14 fields and New_Products table have 16 fields, some fi开发者_Go百科elds are same between both table but different data-types than Master_product

now i want to copy record to Master_product from New_Products, i tried update syntax but it is giving error regarding data-types. That it can't be processed due to different data types.

is there is any way to update Master_product


There are two operators, cast and convert, that might help you in this situation.


If you can convert from the 2 types using convert or cast, then you might be able to do it:

Update Master_product set some_column = Convert(int,other_column) from New_Products
0

精彩评论

暂无评论...
验证码 换一张
取 消