文章分类 -  sql(存储过程)

摘要:--取小数位前数字,不考虑四舍五入selectleft('30000.72234',charindex('.','30000.72234')-1)其中:charindex('.','30000.72234')获得小数点的位置;-1则表示在小数点前面的全部,如果想获取小数点后面的n为,写成+n就可以了。还挺好用的。--每三位用逗号相隔,留2位小数,不考虑四舍五入selectconvert(varchar,cast(round(30000.72234,0)asmoney),1)--每三位用逗号相隔,不留小数位,考虑四舍 阅读全文
posted @ 2008-05-30 17:35 你约我交友网 阅读(1609) 评论(0) 推荐(0)
摘要:--机构计量标准的存储过程 CREATE procedure F_Meter_BZQ ( @PageSize int, --每页的记录数 @PageIndex int, --当前页码 @StrWhere varchar(1000), --查询条件 @User varchar(100) ) AS set nocount on begin create table #aa ( id int ide... 阅读全文
posted @ 2008-05-30 17:21 你约我交友网 阅读(179) 评论(0) 推荐(0)
摘要:Declare @CurrentPage int Declare @PageSize int set @PageSize=6000set @CurrentPage=0Declare @ID int Declare @MoveRecords int --@CurrentPage和@PageSize是传入参数 Set @MoveRecords=@CurrentPage * @PageSize+1 --... 阅读全文
posted @ 2007-08-01 10:12 你约我交友网 阅读(267) 评论(0) 推荐(0)
摘要:例:如何将表PersonInfo表中name相同的记录显示出来:select * from PersonInfo a where (select count(Id) from PersonInfo b where a.Id=b.Id)>1 阅读全文
posted @ 2007-08-01 09:37 你约我交友网 阅读(175) 评论(0) 推荐(0)