随笔分类 -  MS SQL

上一页 1 2
根据汉字的首字母生产拼音码进行查询
摘要:公司里原先的代码,实在没看懂。。。。主要是在Sql中实现USE [Xpos_refer_database] GO /****** Object: UserDefinedFunction [dbo].[GetLetter] Script Date: 04/07/2012 09:22:25 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER function [dbo].[GetLetter](@str nvarchar(4000),@type int) returns nvarchar(4000) -- WITH ... 阅读全文
posted @ 2012-04-07 09:33 LitDev 阅读(1412) 评论(0) 推荐(0)
SQL SELECT DISTINCT 语句
摘要:SQL中 distinct用于返回唯一不同的值。语法:SELECT DISTINCT 列名称 FROM 表名称转载至:http://www.w3school.com.cn/sql/sql_distinct.asp 阅读全文
posted @ 2012-03-30 16:00 LitDev 阅读(296) 评论(0) 推荐(0)
MS SQL2005中ROW_NUMBER() OVER函数的用法
摘要:项目中sql语句源码:select top 5 *, ROW_NUMBER() OVER( order by LastUpdTime desc,id) as RowNumber from (select LastUpdTime'C'+convert(varchar(5),c.c_id) as id, shop.Shop_ID,shop.Shop_TEL,f.f_no,shop.Shop_storeys,shop.shop_mng,c.Pledge,c.LivingRoom,c.KitchenRoom,c.Bathroom,shop.title,shop.xiaoqu,shop. 阅读全文
posted @ 2012-03-27 12:33 LitDev 阅读(2350) 评论(0) 推荐(0)
sql server2005索引
摘要:create index myindex on Student(StudentID) ---创建一个索引,括号内为要为那一列添加索引drop index Student.myindex ---删除索引,需指定“表名.索引列”详细参考于:http://www.2cto.com/database/201201/117131.html 阅读全文
posted @ 2012-02-17 15:26 LitDev 阅读(166) 评论(0) 推荐(0)
sql server2005触发器
摘要:技术参考与:http://apps.hi.baidu.com/share/detail/16489424,此处仅为本人学习入门笔记。学员信息表:学员借书信息表:---功能要求 ---1.如果我更改了学生的学号,我希望他的借书记录仍然与这个学生相关(也就是同时更改借书记录表的学号); ---2.如果该学生已经毕业,我希望删除他的学号的同时,也删除它的借书记录。 ---end ---对于1create trigger UpdateStudent on Student ---为Student表创建触发器for update ---为什么事件触发,有update、insert、delete可用as . 阅读全文
posted @ 2012-02-17 14:18 LitDev 阅读(501) 评论(0) 推荐(0)
MS SQL server 2005中查询某张表从30-40条数据,但主键ID不是连续的
摘要:sql语句:select * from (select * ,row_number() over(order by id) as rowid from TableName) t where t.rowid > 30 and t.rowid <40 阅读全文
posted @ 2012-02-16 12:24 LitDev 阅读(415) 评论(0) 推荐(0)

上一页 1 2