论坛交流
首页办公自动化| 网页制作| 平面设计| 动画制作| 数据库开发| 程序设计| 全部视频教程
应用视频: Windows | Word2007 | Excel2007 | PowerPoint2007 | Dreamweaver 8 | Fireworks 8 | Flash 8 | Photoshop cs | CorelDraw 12
编程视频: C语言视频教程 | HTML | Div+Css布局 | Javascript | Access数据库 | Asp | Sql Server数据库Asp.net  | Flash AS
当前位置 > 文字教程 > Sql Server教程
Tag:注入,存储过程,分页,安全,优化,加密,索引,日志,压缩,base64,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,触发器,socket,安装,sqlserver2000,sqlserver2005,sqlserver2008,视频教程

sql server2000找不到存储过程sp_password的解决方法

文章类别:Sql Server | 发表日期:2012-5-30 10:27:49

sql server2000找不到存储过程sp_password的解决方法


    在学习过程中,很多的朋友都会遇见这种问题,今天给大家分享下如何解决sql server2000找不到存储过程sp_password,我们在查询分析器中运行如下SQL即可:

create procedure sp_password
    @old sysname = NULL,        -- the old (current) password
    @new sysname,               -- the new password
    @loginame sysname = NULL    -- user to change password on
as
    -- SETUP RUNTIME OPTIONS / DECLARE VARIABLES --
 set nocount on
    declare @self int
    select @self = CASE WHEN @loginame is null THEN 1 ELSE 2 END

    -- RESOLVE LOGIN NAME
    if @loginame is null
        select @loginame = suser_sname()

    -- CHECK PERMISSIONS (SecurityAdmin per Richard Waymire) --
 IF (not is_srvrolemember('securityadmin') = 1)
        AND not @self = 1
 begin
    dbcc auditevent (107, @self, 0, @loginame, NULL, NULL, NULL)
    raiserror(15210,-1,-1)
    return (1)
 end
 ELSE
 begin
    dbcc auditevent (107, @self, 1, @loginame, NULL, NULL, NULL)
 end

    -- DISALLOW USER TRANSACTION --
 set implicit_transactions off
 IF (@@trancount > 0)
 begin
  raiserror(15002,-1,-1,'sp_password')
  return (1)
 end

    -- RESOLVE LOGIN NAME (disallows nt names)
    if not exists (select * from master.dbo.syslogins where
                    loginname = @loginame and isntname = 0)
 begin
  raiserror(15007,-1,-1,@loginame)
  return (1)
 end

 -- IF non-SYSADMIN ATTEMPTING CHANGE TO SYSADMIN, REQUIRE PASSWORD (218078) --
 if (@self <> 1 AND is_srvrolemember('sysadmin') = 0 AND exists
   (SELECT * FROM master.dbo.syslogins WHERE loginname = @loginame and isntname = 0
    AND sysadmin = 1) )
  SELECT @self = 1

    -- CHECK OLD PASSWORD IF NEEDED --
    if (@self = 1 or @old is not null)
        if not exists (select * from master.dbo.sysxlogins
                        where srvid IS NULL and
            name = @loginame and
                     ( (@old is null and password is null) or
                              (pwdcompare(@old, password, (CASE WHEN xstatus&2048 = 2048 THEN 1 ELSE 0 END)) = 1) )   )
        begin
      raiserror(15211,-1,-1)
      return (1)
     end

    -- CHANGE THE PASSWORD --
    update master.dbo.sysxlogins
 set password = convert(varbinary(256), pwdencrypt(@new)), xdate2 = getdate(), xstatus = xstatus & (~2048)
 where name = @loginame and srvid IS NULL

 -- UPDATE PROTECTION TIMESTAMP FOR MASTER DB, TO INDICATE SYSLOGINS CHANGE --
 exec('use master grant all to null')

    -- FINALIZATION: RETURN SUCCESS/FAILURE --
 if @@error <> 0
        return (1)
    raiserror(15478,-1,-1)
 return  (0) -- sp_password

    好了,方法就给大家介绍到这里了,下次遇见这样的问题用以上的方法试试吧!

视频教程列表
文章教程搜索
 
Sql Server推荐教程
Sql Server热门教程
看全部视频教程
购买方式/价格
购买视频教程: 咨询客服
tel:15972130058