SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SP set "With Encryption" issues


SP set "With Encryption" issues

Author
Message
AhTu_SQL2k+
AhTu_SQL2k+
SSChasing Mays
SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)

Group: General Forum Members
Points: 641 Visits: 282
For all my SQL functions (from SQL server 2005--2017), I created them "WITH ENCRYPTION" as the following sample. I have never had any problems with that until this morning when I was preparing to deploy one function after debugging. The function keep looping and it would never return result. When I took away "WITH ENCRYPTION" and rebuilt it, result returned in 1s.
Can anyone tells what I have missed here? I don't want to deploy my functions without encryption.

Thanks in advance.
Wilson


CREATE FUNCTION myfuctions (@P1 Char(6))
RETURNS @BalTable TABLE
(col1 varchar(6), col2 varchar(30), etc...)

WITH ENCRYPTION
AS
BEGIN
....
END



This is the first time I encounter

Together, we can make wonders!
sgmunson
sgmunson
SSC Guru
SSC Guru (107K reputation)SSC Guru (107K reputation)SSC Guru (107K reputation)SSC Guru (107K reputation)SSC Guru (107K reputation)SSC Guru (107K reputation)SSC Guru (107K reputation)SSC Guru (107K reputation)

Group: General Forum Members
Points: 107967 Visits: 7500
Do you seriously expect us to look at nothing and magically see where your problem is? Seriously?

Steve
‌(aka sgmunson)
Smile Smile Smile
Health & Nutrition
AhTu_SQL2k+
AhTu_SQL2k+
SSChasing Mays
SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)

Group: General Forum Members
Points: 641 Visits: 282
Hi Steve,
I feel your frustration on my previous question, I apologize for that. English is my second language and perhaps I didn't describe the question clearly in my post. What I am curiously to find out is why after I added the option "WITH ENCRYPTION" to the fast working script (1 second ) will cause it halted (keep querying for hours). I was trying to point out where the option is added by the sample only, not to seek for help to rectify the script.

Together, we can make wonders!
sgmunson
sgmunson
SSC Guru
SSC Guru (107K reputation)SSC Guru (107K reputation)SSC Guru (107K reputation)SSC Guru (107K reputation)SSC Guru (107K reputation)SSC Guru (107K reputation)SSC Guru (107K reputation)SSC Guru (107K reputation)

Group: General Forum Members
Points: 107967 Visits: 7500
AhTu_SQL2k+ - Thursday, March 14, 2019 9:08 PM
Hi Steve,
I feel your frustration on my previous question, I apologize for that. English is my second language and perhaps I didn't describe the question clearly in my post. What I am curiously to find out is why after I added the option "WITH ENCRYPTION" to the fast working script (1 second ) will cause it halted (keep querying for hours). I was trying to point out where the option is added by the sample only, not to seek for help to rectify the script.

I'd already validated that your syntax wasn't the problem. However, with no idea what the function does or the code within, we've got zero chance at helping. Although there are a couple of things to try. Force the object to be recompiled by running sp_recompile on it. Then capture an execution plan when you run it with encryption, and again when you run it without. Look at the differences. It might tell you something. However, without either of those execution plans, we're probably going to be left guessing.

EDIT: Be sure to recompile between executions, so you are starting at a known point each time.


Steve
‌(aka sgmunson)
Smile Smile Smile
Health & Nutrition
AhTu_SQL2k+
AhTu_SQL2k+
SSChasing Mays
SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)

Group: General Forum Members
Points: 641 Visits: 282
Thanks,Steve for the head up. I will try your suggestions and find out the issue.

Together, we can make wonders!
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (975K reputation)SSC Guru (975K reputation)SSC Guru (975K reputation)SSC Guru (975K reputation)SSC Guru (975K reputation)SSC Guru (975K reputation)SSC Guru (975K reputation)SSC Guru (975K reputation)

Group: General Forum Members
Points: 975184 Visits: 49307
My recommendation is to stop using "WITH ENCRYPTION". It does virtually nothing to protect your code. Even software packages like RedGate SQL Compare automatically breaks the encryption so the user can view the code to compare between two databases.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

When you put the right degree of spin on it, the number 318 is also a glyph that describes the nature of a DBAs job. Wink

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum









































































































































































SQLServerCentral


Search