我正在填充大量的预定义数据到表中(在我的部署后的sql脚本中) 有没有办法创建C#样式区域,以便我可以折叠插入块以提高可读性和完整性?有没有办法在.sql脚本中创建区域?
这里是一个简短的样品(#区域被注释掉):
MERGE INTO [MYTable] AS Target
USING (VALUES
--#region Measurement_Id = 1 'Flow' for all reasources
(1, 1, 1, 45, NULL, NULL)
,(2, 2, 1, 56, NULL, NULL)
,(3, 3, 1, NULL, NULL, NULL)
,(4, 4, 1, 67.5, 87, NULL)
,(5, 5, 1, NULL, NULL, NULL)
,(6, 6, 1, 54., NULL, 87)
,(7, 7, 1, NULL, NULL, NULL)
--#endregion
--#region Measurement_Id = 2 'Disc' for all reasources
(1, 1, 2, NULL, NULL, NULL)
,(2, 2, 2, NULL, NULL, NULL)
,(3, 3, 2, NULL, NULL, NULL)
,(4, 4, 2, NULL, NULL, NULL)
,(5, 5, 2, NULL, NULL, NULL)
--#region
...
) AS Source ([Measurement_Id],[Measurement_Nm],[Measurement_Cd],[Measurement_Desc],[IsActive_Ind])
ON (Target.[Measurement_Id] = Source.[Measurement_Id])
可能重复的[数据库 - 如何在TSQL中创建区域(SQL Server 2008)](http://stackoverflow.com/questions/7066011/database-how-to-create-regions-in-tsql-sql- server-2008) – 2014-02-05 20:14:24