zoukankan      html  css  js  c++  java
  • 常用的数据库代码

    --挂起业务存储过程
    create procedure [dbo].[p_suspend_business] 
       @Bfixednum  varchar(40)
    as
    begin transaction
    
      declare @SNumber int
      declare @messageNumber int
      select @SNumber=SNumber from sendnumber where Bfixednum=@Bfixednum
      select @messageNumber = count(@Bfixednum) from [message] where Bfixednum = @Bfixednum and mDate between (select  dateadd(dd,-day(getdate())+1,getdate()))  and   (select  dateadd(dd,-day(getdate()),dateadd(m,1,getdate())))
    
    
      --参数检查
      if (@SNumber is null or @messageNumber = '')
        begin
          raiserror('错误!缺少参数 ,请检查!',16,1)
          rollback
          return
        end
      
      if (@messageNumber >= @SNumber)
        begin
         update dbo.Business set BState=0 where  Bfixednum=@Bfixednum
       commit transaction    
        end
    
    GO
    
    
    
    
    利用系统存储过程建立数据库链接
    EXEC sp_addlinkedserver 
       'lkTest', 
       '', 
       'MSDASQL',
       NULL,
       NULL,
       'DRIVER={SQL Server};SERVER=地址;UID=sa;PWD=密码;'
     go
    
    --测式数据库语句运行的时间
    declare @starttime as datetime;
    declare @endtime as datetime;
    set @starttime = getdate(); 
    --运行的语句  
    select * from dbo.total where  companyinfo like '%中南一路%'
    set @endtime = getdate();select @starttime as 开始时间,@endtime as 结束时间,datediff(MS,@starttime,@endtime)as 运行时间
    
    
  • 相关阅读:
    jQuery扩展extend一
    json对象的操作,json工具
    typeof操作符的返回值
    jacksonall的使用,解析json
    jQuery的扩展
    An Introduction to Computer Thinking
    lazy初始化和线程安全的单例模式
    Compiler Principle
    Lineare Algebra
    Mathematik
  • 原文地址:https://www.cnblogs.com/and/p/1696930.html
Copyright © 2011-2022 走看看