SQL Server Stored Procedure function encryption and decryption

Source: Internet
Author: User
SQL Server Stored Procedure function encryption and decryption encryption of stored procedures and functions: WITHENCRYPTION! -- [If! SupportLineBreakNewLine] --! -- [Endif] -- CREATEproceduredbo. sp_XML_main @ table_namenvarchar (260), @ dirnamenvarchar (20) WITHENCRYPTIONasbegin ......

SQL Server Stored Procedures/function ENCRYPTION/Decryption 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 ......

SQL Server Stored Procedure/function encryption/Decryption

ENCRYPTION of stored procedures and stored functions: WITH ENCRYPTION

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

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.