SQL Server Stored Procedure/function encryption/decryption (encryption)

Source: Internet
Author: User
Encryption of stored procedures and stored functions: With Encryption

<! -- [If! Supportlinebreaknewline] -->
<! -- [Endif] -->

Create procedure DBO. sp_xml_main

@ Table_name nvarchar (260) = '',

@ Dirname nvarchar (20) =''

With Encryption

As

Begin

....................

End

Go

Decryption of stored procedures and stored Functions

If exists (select * From DBO. sysobjects where id = object_id (n' [DBO]. [sp_decrypt] ') and objectproperty (ID, n' isprocedure') = 1)

Drop procedure [DBO]. [sp_decrypt]

Go

/* -- Crack functions, processes, triggers, and views. Limited to sqlserver2000

-- Author: j9988 -- All Rights Reserved */

/* -- Call example

-- Decrypts a specified Stored Procedure

Exec sp_decrypt 'encrypt P _ Test'

-- Decrypt all stored procedures

Declare TB cursor

Select name from sysobjects where xtype = 'p' and status> 0 and name <> 'SP _ decrypt'

Declare @ name sysname

Open TB

Fetch next from TB into @ name

While @ fetch_status = 0

Begin

Print '/* ------- stored procedure [' + @ name + '] ----------- */'

Exec sp_decrypt @ name

Fetch next from TB into @ name

End

Close TB

Deallocate TB

--*/

If exists (select * From DBO. sysobjects where id = object_id (n' [DBO]. [sp_decrypt] ') and objectproperty (ID, n' isprocedure') = 1)

Drop procedure [DBO]. [sp_decrypt]

Go

Create procedure sp_decrypt (@ objectname varchar (50 ))

As

Begin

Set nocount on

-- Unlimitedly cracked bytes, applicable to sqlserver2000 stored procedures, functions, views, and triggers

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.