上一个项目快基本Over了.
其中做到了一个功能,把它记下来.
当时的功能需求是: 写一个Job,将Sql Server数据库中两个表的数据从Oracle数据库中同步过来,此Job每天凌晨跑.
Job,我先不谈怎么写了,下面主要共享一下核心的Sql查询语句.
其实很简单,希望给需要的人带来帮助.
嘿嘿.
其中做到了一个功能,把它记下来.
当时的功能需求是: 写一个Job,将Sql Server数据库中两个表的数据从Oracle数据库中同步过来,此Job每天凌晨跑.
Job,我先不谈怎么写了,下面主要共享一下核心的Sql查询语句.
1Update ProductItem
2Set ProductItem.piDescriptionS = convert(varchar(250), ISNULL(ITEM.ITEM_DESC, '')),
3 ProductItem.ITEM_TYPE = convert(varchar(50), ISNULL(ITEM.ITEM_TYPE, '')),
4 ProductItem.PRODUCT_GROUP = convert(varchar(50), ISNULL(ITEM.PRODUCT_GROUP, '')),
5 ProductItem.PRODUCT_LINE = convert(char(3), ISNULL(ITEM.PRODUCT_LINE, '')),
6 ProductItem.BIG_CLASS = convert(varchar(50), ISNULL(ITEM.BIG_CLASS, '')),
7 ProductItem.MIDDLE_CLASS = convert(varchar(50), ISNULL(ITEM.MIDDLE_CLASS, '')),
8 ProductItem.SMALL_CLASS = convert(varchar(100), ISNULL(ITEM.SMALL_CLASS, ''))
9From ProductItem, (Select DISTINCT ITEM_NO, ITEM_DESC, ITEM_TYPE, PRODUCT_GROUP, PRODUCT_LINE, BIG_CLASS, MIDDLE_CLASS, SMALL_CLASS From opendatasource('MSDAORA', 'Data Source=dbname;User ID=abc;Password=abc')..APPS.XXC0IN_EORDER_ITEM_V ) As ITEM
10Where ProductItem.piitem = ITEM.ITEM_NO
2Set ProductItem.piDescriptionS = convert(varchar(250), ISNULL(ITEM.ITEM_DESC, '')),
3 ProductItem.ITEM_TYPE = convert(varchar(50), ISNULL(ITEM.ITEM_TYPE, '')),
4 ProductItem.PRODUCT_GROUP = convert(varchar(50), ISNULL(ITEM.PRODUCT_GROUP, '')),
5 ProductItem.PRODUCT_LINE = convert(char(3), ISNULL(ITEM.PRODUCT_LINE, '')),
6 ProductItem.BIG_CLASS = convert(varchar(50), ISNULL(ITEM.BIG_CLASS, '')),
7 ProductItem.MIDDLE_CLASS = convert(varchar(50), ISNULL(ITEM.MIDDLE_CLASS, '')),
8 ProductItem.SMALL_CLASS = convert(varchar(100), ISNULL(ITEM.SMALL_CLASS, ''))
9From ProductItem, (Select DISTINCT ITEM_NO, ITEM_DESC, ITEM_TYPE, PRODUCT_GROUP, PRODUCT_LINE, BIG_CLASS, MIDDLE_CLASS, SMALL_CLASS From opendatasource('MSDAORA', 'Data Source=dbname;User ID=abc;Password=abc')..APPS.XXC0IN_EORDER_ITEM_V ) As ITEM
10Where ProductItem.piitem = ITEM.ITEM_NO
其实很简单,希望给需要的人带来帮助.
嘿嘿.