12 2012 档案

网页上显示时间,和星期几
摘要:<html><head><script type="text/javascript">function startTime(){var today=new Date()var h=today.getHours()var m=today.getMinutes()var s=today.getSeconds()// add a zero in front of numbers<10m=checkTime(m)s=checkTime(s)document.getElementById('txt').innerHTML=h+ 阅读全文

posted @ 2012-12-27 14:03 翠儿 阅读(647) 评论(3) 推荐(0)

sql字符串函数大全
摘要:STR() 把数值型数据转换为字符型数据。STR (<float_expression>[,length[, <decimal>]]) length 指定返回的字符串的长度,decimal 指定返回的小数位数。如果没有指定长度,缺省的length 值为10, decimal 缺省值为0。 当length 或者decimal 为负值时,返回NULL; 当length 小于小数点左边(包括符号位)的位数时,返回length 个*; 先服从length ,再取decimal ; 当返回的字符串位数小于length ,左边补足空格。一、去空格函数1、LTRIM() 把字符串头部 阅读全文

posted @ 2012-12-26 17:18 翠儿 阅读(270) 评论(0) 推荐(0)

Sql语言中的日期格式化
摘要:日期格式化View Code 1 lect CONVERT(varchar(100), GETDATE(), 0): 05 16 2006 10:57AM 2 Select CONVERT(varchar(100), GETDATE(), 1): 05/16/06 3 Select CONVERT(varchar(100), GETDATE(), 2): 06.05.16 4 Select CONVERT(varchar(100), GETDATE(), 3): 16/05/06 5 Select CONVERT(varchar(100), GETDATE(), 4): 16.05.06 6. 阅读全文

posted @ 2012-12-26 16:28 翠儿 阅读(528) 评论(0) 推荐(0)

sql常用函数
摘要:Sql Server数据类型转换函数此类函数有两个:・CAST()CAST() 函数语法如下:CAST (<expression> AS <data_ type>[ length ])・CONVERT()CONVERT() 函数语法如下:CONVERT (<data_ type>[ length ], <expression> [, style])提醒: 1、data_type为SQL Server系统定义的数据类型,用户自定义的数据类型不能在此使用。2、length用于指定数据的长度,缺省值为30。3、把CHAR或VARCHAR类型转换为诸如I 阅读全文

posted @ 2012-12-26 16:25 翠儿 阅读(373) 评论(1) 推荐(0)

T-SQL排序,重复数据的剔除保留,分页存储过程
摘要:select*fromscore --剔除重复项 selectdistinct(score)fromscore --保留重复项(注意:withties必须和top...orderby一起使用) selecttop1withtiesscorefromscore orderbyscoredesc --newid() selectnewid()as'新ID',*fromscore --根据‘成绩’字段的降序排列生成‘行号’ selectrow_number()over(orderbyScoredesc)as'行号', stuIDas'学号',Score 阅读全文

posted @ 2012-12-26 15:24 翠儿 阅读(564) 评论(0) 推荐(0)

SQL排序查询
摘要:1.建一张客户表,包含客户名称,联系人,电话号码,公司地址.2.建一张订单表,包含订单编号,客户ID,供应商ID,订单金额,客户支付状态,供应商支付状态,订单日期.3.建一张供应商表,包含供应商名称,联系人,电话号,供应商地址View Code 1 create table customer 2 ( 3 customerID int primary key identity(1,1) , 4 customerName varchar(50), 5 cuslinkMan varchar(50), 6 customerPhone varchar(12), 7 companyAdress var.. 阅读全文

posted @ 2012-12-25 16:23 翠儿 阅读(474) 评论(0) 推荐(1)

查询的逻辑执行顺序
摘要:查询的逻辑执行顺序FROM < left_table>ON < join_condition>< join_type> JOIN < right_table>WHERE < where_condition>GROUP BY < group_by_list>WITH {cube | rollup}HAVING < having_condition>SELECTDISTINCTORDER BY < order_by_list>< top_specification> < select_ 阅读全文

posted @ 2012-12-25 09:57 翠儿 阅读(303) 评论(0) 推荐(0)

insert into 和select into 的用法
摘要:1.INSERT INTO SELECT语句语句形式为:Insert into Table2(field1,field2,...) select value1,value2,... from Table1 要求目标表Table2必须存在,由于目标表Table2已经存在,所以我们除了插入源表Table1的字段外,还可以插入常量。示例如下: 2.SELECT INTO FROM语句语句形式为:SELECT vale1, value2 into Table2 from Table1 要求目标表Table2不存在,因为在插入时会自动创建表Table2,并将Table1中指定字段数据复制到Table2. 阅读全文

posted @ 2012-12-24 17:54 翠儿 阅读(196) 评论(0) 推荐(0)

HashTable数据库int型,前台字符显示
摘要:public class AppConstant中 #region 公告分类状态 public static Hashtable StatusHash = new Hashtable { {"0","全部"}, {"1","公司行规"},{"2","职场秘籍"},{"3","生活小提示"},{"4","电视剧场"},{"5","家庭影院"},{"6 阅读全文

posted @ 2012-12-24 10:54 翠儿 阅读(350) 评论(0) 推荐(0)

选中checkbox
摘要:<script type="text/javascript">function getSelectedUsers() { var sltUser = ""; var arrSelect = document.getElementsByName("myCheckBox"); for (i = 0; i < arrSelect.length; i++) { if (arrSelect[i].checked) { sltUser += arrSelect[i].value + ","; i[0]+=1; 阅读全文

posted @ 2012-12-24 10:30 翠儿 阅读(120) 评论(0) 推荐(0)

光标定位、模糊查询
摘要:<script type="text/javascript"> function init(){ var lgn = document.getElementById("txtName"); lgn.focus(); }select * from tblUser where userName='' or userName='@userName' userName like '%'+@userName+‘%’ 阅读全文

posted @ 2012-12-24 10:01 翠儿 阅读(86) 评论(0) 推荐(0)