随笔分类 -  SQL

摘要:using System;using System.Collections;using System.Collections.Specialized;using System.Data;using System.Data.SqlClient;using System.Configuration;us 阅读全文
posted @ 2018-07-09 14:22 jeffrey77
摘要:修改某字段的默认值:alter table dbo.aspnet_Users add default getdate() for LastActivityDate alter table dbo.aspnet_Users add default newid()for UID修改某字段的类型:alter table 表名 alter column 列名 nvarchar(500) 阅读全文
posted @ 2013-04-07 21:27 jeffrey77 阅读(170) 评论(0) 推荐(0)
摘要:正常情况下(要求not in字段唯一)selecttoppageSize*formtablewhereidnotin (selecttoppageSize*page-pageSizeidfromtableorderbyid)orderbyid 如果为联合主键selecttoppageSize*formtablewhereid1+id2notin (selecttoppageSize*page-pageSizeid1+id2fromtableorderbyid)orderbyid 阅读全文
posted @ 2012-07-26 15:34 jeffrey77 阅读(225) 评论(0) 推荐(0)
摘要:CREATE PROCEDURE proc_pagination(@tblName nvarchar(1000), ----要显示的表或多个表的连接,必须参数@fldName nvarchar(4000) = '*', ----要显示的字段列表@fldSort nvarchar(4000) = null, ----排序字段列表或条件@fldFSort nvarchar(4000) = null, ----反向排序字段列表或条件(这个需要在调用前准备好,且一定要与原始排序完全相反)@strCondition nvarchar(4000) = null, ... 阅读全文
posted @ 2012-07-26 15:26 jeffrey77 阅读(238) 评论(0) 推荐(0)