using System; using System.Web; using System.Text; using System.Web.UI.WebControls; using System.Text.RegularExpressions; public class ValidateHelper { private static Regex RegNumber = new Regex("^[0-9]+$"); p…
--创建存储过程 IF EXISTS (SELECT * FROM sysobjects WHERE name='GetSplitString' AND xtype='p') DROP PROCEDURE dbo.GetSplitString GO CREATE PROCEDURE dbo.GetSplitString @strID nvarchar(max) --以逗号隔开的字符串 ,) output --临时表 AS BEGIN declare @totalLength int declar…
例如:有表MO_Cook,字段:FoodRoom,name 有如下数据: 要求:将FoodRoom中值相同的字段合并成一行,并将name的值用逗号隔开. 需要用到:STUFF函数. 查询语句如下: select FoodRoom, stuff((select ','+name from MO_Cook where c.FoodRoom=FoodRoom ,,'') as CookNames from MO_Cook c group by c.FoodRoom 查询结果如下: STUFF (…