Saturday, April 11, 2015

Using WITH ENCRYPTION option obfuscates the definition of the procedure in T-SQL

CREATE PROCEDURE [dbo].[CustOrdersDetail_Encrypted] @OrderID int
WITH ENCRYPTION
AS
SELECT ProductName,
    UnitPrice=ROUND(Od.UnitPrice, 2),
    Quantity,
    Discount=CONVERT(int, Discount * 100),
    ExtendedPrice=ROUND(CONVERT(money, Quantity * (1 - Discount) * Od.UnitPrice), 2)
FROM Products P, [Order Details] Od
WHERE Od.ProductID = P.ProductID and Od.OrderID = @OrderID

Effects after encryption

 

image

 

image

image

image

image