随笔分类 -  SQL

sql server
摘要:1 表结构: 2 create database MyCompany 3 go 4 use MyCompany 5 go 6 create table Departments 7 ( 8 Department_ID int identity(1,1) primary key, 9 Departmen 阅读全文
posted @ 2017-03-17 12:24 南潇湘 阅读(256) 评论(0) 推荐(0)
摘要:创建数据库 1 USE master; 2 GO 3 --日记数据库 4 create database DiaryBase 5 on 6 ( 7 name=DiaryBase_Dat,--逻辑名称 8 FILENAME='c:\DiaryBase.log', 9 size=10MB, 10 max 阅读全文
posted @ 2017-03-15 13:33 南潇湘 阅读(399) 评论(0) 推荐(0)
摘要:alter proc usp_trancMoney @from char(4), @to char(4), @money money , @isok int output as begin declare @have money =-1 ,@iscunzai int =0 select @have= 阅读全文
posted @ 2017-03-15 09:22 南潇湘 阅读(158) 评论(0) 推荐(0)
摘要:转自 http://blog.csdn.net/limlimlim/article/details/8626898 注意:当SQL语句中出现两条Select语句,例如:string sql = "select * from Employees;select * from TblClass"; 可以用 阅读全文
posted @ 2017-02-26 10:48 南潇湘 阅读(1299) 评论(2) 推荐(0)
摘要:在Ado.net中 从数据库中读出的数据 判断是否为空 Console.Write(reader.IsDBNull(3) ? "NULL" : reader.GetInt32(3) ); 阅读全文
posted @ 2016-01-21 17:11 南潇湘 阅读(3399) 评论(0) 推荐(0)
摘要:1.什么是Inserted 和Deleted表 当插入数据的时候,其实是同时向目的表 和inserted表中插入数据,当没有出错时,向数据库中插入提交,inserted表中有刚插入的信息, insert into student ([name],defaltage) output inserted. 阅读全文
posted @ 2016-01-19 10:42 南潇湘 阅读(824) 评论(0) 推荐(0)
摘要:SELECT request_session_id spid,OBJECT_NAME(resource_associated_entity_id)tableName FROM sys.dm_tran_locks WHERE resource_type='OBJECT ' 阅读全文
posted @ 2013-04-09 17:13 南潇湘 阅读(182) 评论(0) 推荐(0)
摘要:--获取最小: --方法1:CREATE FUNCTION [dbo].[MinimumDateValue] () RETURNS DATETIMEASBEGIN RETURN CONVERT(DATETIME, '1753-01-01', 121)END --方法2: declare @Date smalldatetimeset @Date=0select @Date --获取最大 CREATE FUNCTION [dbo].[MaximumDateValue] () RETURNS DATETIMEASBEGIN RETURN CONVERT(DATETIME, ' 阅读全文
posted @ 2013-03-12 10:50 南潇湘 阅读(1620) 评论(0) 推荐(0)
摘要:public IQueryable<BBS_Theme> GetListPage(int PageSize, int PageIndex, NameValueCollection nvcParamWhere, NameValueCollection nvcorderby, ref int AllCount) { #region where var searchPredicate = PredicateExtensions.True<BBS_Theme>(); if (nvcParamWhere != null) { ... 阅读全文
posted @ 2013-01-07 18:00 南潇湘 阅读(2615) 评论(0) 推荐(0)