文章分类 -  SQL Server

SQL Server
摘要:方法一:convert(float,字段名) as 别名select convert(float,round(10.123232,2))结果:10.12select convert(float,round(10,2))结果:10方法二:cast(round(字段名,2) as numeric(20,... 阅读全文
posted @ 2014-04-14 14:46 魔豆 阅读(15568) 评论(0) 推荐(0) 编辑
摘要:execsp_renamedb'old_name','new_name' 阅读全文
posted @ 2005-04-27 12:19 魔豆 阅读(1135) 评论(1) 推荐(0) 编辑
摘要:SETNOCOUNTON; insertintotable1()values(''); select@@IDENTITY; SETNOCOUNTOFF; 阅读全文
posted @ 2005-04-27 12:16 魔豆 阅读(667) 评论(0) 推荐(0) 编辑
摘要:select * from TableName order by newid() 阅读全文
posted @ 2005-04-27 11:48 魔豆 阅读(523) 评论(1) 推荐(0) 编辑
摘要:begin transaction …… commit transaction 阅读全文
posted @ 2005-04-27 11:46 魔豆 阅读(922) 评论(0) 推荐(0) 编辑
摘要:select Min(VisitTime),count(*) as Num from online group by datediff(day,VisitTime,getdate()) 阅读全文
posted @ 2005-04-27 11:44 魔豆 阅读(2667) 评论(1) 推荐(1) 编辑
摘要:convert(varchar(10),date1,120) 阅读全文
posted @ 2005-04-27 11:43 魔豆 阅读(1207) 评论(0) 推荐(0) 编辑
摘要:方法一: sp_MShelpcolumns '表名' 方法二: sp_help '表名' 方法三: select * from information_schema.columns where table_name='表名' 三种方法查出来的效果不一样,可以根据情况选择使用. 阅读全文
posted @ 2005-04-27 11:40 魔豆 阅读(478) 评论(0) 推荐(0) 编辑
摘要:select datepart(weekday,getdate()) 1为星期日,2为星期一,3为星期二,…… 阅读全文
posted @ 2005-04-27 11:37 魔豆 阅读(1384) 评论(0) 推荐(0) 编辑
摘要:declare @dt datetime set @dt=getdate() select 32-Day(@dt+(32-Day(@dt))) 阅读全文
posted @ 2005-04-27 11:35 魔豆 阅读(781) 评论(0) 推荐(0) 编辑
摘要:select identity(int,1,1) as id,username into #temp from table1 group by username select * from #temp 阅读全文
posted @ 2005-04-27 11:32 魔豆 阅读(791) 评论(0) 推荐(0) 编辑
摘要:DBCC checkident(tablename,RESEED,1) 阅读全文
posted @ 2005-04-27 11:31 魔豆 阅读(318) 评论(0) 推荐(0) 编辑
摘要:下面的示例将登录用户的密码由ok改为coffee EXEC sp_password 'ok','coffee' 阅读全文
posted @ 2005-04-27 11:29 魔豆 阅读(443) 评论(0) 推荐(0) 编辑
摘要:下例将表customers重命名为custs EXEC sp_rename 'customers','custs' 阅读全文
posted @ 2005-04-27 11:27 魔豆 阅读(14984) 评论(0) 推荐(1) 编辑

点击右上角即可分享
微信分享提示