Home >Database >Mysql Tutorial >利用CodeSmith 把SqlServer表数据生成INSERT INTO ... 的 SQL

利用CodeSmith 把SqlServer表数据生成INSERT INTO ... 的 SQL

WBOY
WBOYOriginal
2016-06-07 15:33:241539browse

过去转过一篇文章,是利用存储过程生成,手法又复杂,又容易出错 http://blog.csdn.net/lee576/article/details/3511012 今天偶尔发现CodeSmith下有这个模板,这下方便了,呵呵 选中下图的结点,ScriptTableData.cst 具体的模板代码就不贴了,都看得到,在属性框里把

过去转过一篇文章,是利用存储过程生成,手法又复杂,又容易出错

http://blog.csdn.net/lee576/article/details/3511012

今天偶尔发现CodeSmith下有这个模板,这下方便了,呵呵

选中下图的结点,ScriptTableData.cst

利用CodeSmith 把SqlServer表数据生成INSERT INTO ... 的 SQL

具体的模板代码就不贴了,都看得到,在属性框里把SourceTable选上

利用CodeSmith 把SqlServer表数据生成INSERT INTO ... 的 SQL

点工具栏的"Generate",生成了一个该表的一窜SQL

SET IDENTITY_INSERT [dbo].[AnalogyData1] ON

INSERT INTO [dbo].[AnalogyData1] (
	[Block],
	[LayerCode],
	[ProduceDate],
	[OilWells],
	[WaterWells],
	[ProduceOil],
	[ProduceWater],
	[YCY],
	[Waterflooding],
	[ProduceGas],
	[HSL],
	[TotalOil],
	[TotalGas],
	[TotalWater],
	[AnareservoirID]
)
	SELECT '彩9', 'J1s', '199707', 81, 6, 40855, 8617, '49472', 14047, 450.3, '17.4', 1500253, 21628.1, 225428, '6053A294-8505-4120-BF92-63BCA08948CC' UNION
	SELECT '彩9', 'J1s', '200202', 88, 7, 28496, 36873, '65369', 23286, 347.9, '56.4', 3630318, 49139.7, 1421461, '6053A294-8505-4120-BF92-63BCA08948CC' UNION ......




Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn