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


CLR Integration in SQL


CLR Integration in SQL

Author
Message
binak_86
binak_86
SSC-Enthusiastic
SSC-Enthusiastic (176 reputation)SSC-Enthusiastic (176 reputation)SSC-Enthusiastic (176 reputation)SSC-Enthusiastic (176 reputation)SSC-Enthusiastic (176 reputation)SSC-Enthusiastic (176 reputation)SSC-Enthusiastic (176 reputation)SSC-Enthusiastic (176 reputation)

Group: General Forum Members
Points: 176 Visits: 17
Comments posted to this topic are about the item CLR Integration in SQL
sharky
sharky
SSC Eights!
SSC Eights! (973 reputation)SSC Eights! (973 reputation)SSC Eights! (973 reputation)SSC Eights! (973 reputation)SSC Eights! (973 reputation)SSC Eights! (973 reputation)SSC Eights! (973 reputation)SSC Eights! (973 reputation)

Group: General Forum Members
Points: 973 Visits: 569
Although the article showed the implementation of CLR, the examples used can in my opinion lead to bad practices. I will use check constraints for validation without CLR or stored procedures, and used the allready build in encription instead of building your own.
binak_86
binak_86
SSC-Enthusiastic
SSC-Enthusiastic (176 reputation)SSC-Enthusiastic (176 reputation)SSC-Enthusiastic (176 reputation)SSC-Enthusiastic (176 reputation)SSC-Enthusiastic (176 reputation)SSC-Enthusiastic (176 reputation)SSC-Enthusiastic (176 reputation)SSC-Enthusiastic (176 reputation)

Group: General Forum Members
Points: 176 Visits: 17
Keeping in mind the scenario posted in the article, we are just developing the database, and not responsible for the applications which will be sending data, so in other words we are responsible for data validation, do tell what other ways can be used to implement validation without CLR? Smile
David Data
David Data
SSCrazy
SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)

Group: General Forum Members
Points: 2421 Visits: 829
The article describes how to do this in Open Visual Studio 2010.
Is it possible to do the same in the version of Open Visual Studio 2008 that comes with SQL Server 2008 BIDS?
binak_86
binak_86
SSC-Enthusiastic
SSC-Enthusiastic (176 reputation)SSC-Enthusiastic (176 reputation)SSC-Enthusiastic (176 reputation)SSC-Enthusiastic (176 reputation)SSC-Enthusiastic (176 reputation)SSC-Enthusiastic (176 reputation)SSC-Enthusiastic (176 reputation)SSC-Enthusiastic (176 reputation)

Group: General Forum Members
Points: 176 Visits: 17
[font="Times New Roman"]Although I haven't tried to do this on VS 2008, but I think it should be do-able as I haven't used anything .NET 4.0 specific. Let me try this and get back to you.[/font]
dukemus
dukemus
SSC Journeyman
SSC Journeyman (84 reputation)SSC Journeyman (84 reputation)SSC Journeyman (84 reputation)SSC Journeyman (84 reputation)SSC Journeyman (84 reputation)SSC Journeyman (84 reputation)SSC Journeyman (84 reputation)SSC Journeyman (84 reputation)

Group: General Forum Members
Points: 84 Visits: 73
The only thing in that table that requires CLR is Email field to validate with regular expression.
How about pwdencrypt and pwdcompare? If I remember correctly these are available since SQL 7 (for sure since SQL 2000). These are the same functions used by sql to encrypt login passwords and results are 100% compatible with "alter login", "create login" etc.
If you use any other algorithm that allows password decryption, then there is no use to encrypt password as the key is also in database or CLR and just call the CLR and you have the results



jshahan
jshahan
Hall of Fame
Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)

Group: General Forum Members
Points: 3632 Visits: 2219
Removing this posting and starting another thread
k4tay
k4tay
Valued Member
Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)

Group: General Forum Members
Points: 72 Visits: 9
I am having some issues deploying my CLR project but after reading this article i suspect it has to do with my project must be using version 4 of the framework where this article specifically states to be sure and change it to 3.5. Can soneone comment as to why this was required? Ill be checking my project once i get into the office.
sharky
sharky
SSC Eights!
SSC Eights! (973 reputation)SSC Eights! (973 reputation)SSC Eights! (973 reputation)SSC Eights! (973 reputation)SSC Eights! (973 reputation)SSC Eights! (973 reputation)SSC Eights! (973 reputation)SSC Eights! (973 reputation)

Group: General Forum Members
Points: 973 Visits: 569
I see what you have done, and the example is perfectly valid for demonstration purposes, and well written. I just want to emphasize best practices.
There might be a need to write you own .net security class code to encrypt the password at the client or middle tier to keep the decrypted one away from the database, but writing a CLR to do that then defeats the purpose. You should use passphrase/keys , and not CLR code for that.
Also easier and more manageable to create check constraints rather than stored procs for validation.
Nadrek
Nadrek
SSCoach
SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)

Group: General Forum Members
Points: 15931 Visits: 2752
Interesting article, but I would note that the email address validation isn't the example I would have chosen.

An actual RegEx to validate email per RFC822 is at http://www.ex-parrot.com/pdw/Mail-RFC822-Address.html; it's significantly complex.

Also, if the example is to transparently handle validation, then any password hashing must be handled at the client. Passwords should also be hashed, not encrypted, and many, many times; that's a whole separate article.
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