Tuesday, February 14, 2012

Do you like to break the rules ?

Not long ago I accountered this situation: I had two databases on "MS SQL Server". In one of the databases there was a nomenclature with very large primary key.
I had to transport that nomenclature and transform the wide PK into single identity column into the other database.

I decided to use a function for that transformation. BUT that function had to mark somewhere which combination of the PK columns is relative to which identity value. BUT functions CAN'T WRITE under MSSQL.
So I took the challenge and mine all sources of information. The result was a function "Exec4Fun" that breaks the rule.
I suppose that with this function it's possible to avoid the restriction for triggers, which prevents writing in the triggering table? (not tested yet)

If someone needs such tools, just write back your e-mail and I'll send some code.

All the best and have fun :)Oh yeah? Wow!!! Let's see if it's a copy of what Itzik Ben Gan talks about in his "back doors" to UDF's. And here's the code from his article (http://www.winnetmag.com/Files/09/41845/41845.zip)|||My Fun has the same origins as "Listing_04.UsingOPENQUERY()toPerformanUpdate.txt". There was used the linked-server approach which lies on ADODB. But I got deeper. I use directly ADODB through "sp_OACreate" procedures and also handle the errors.

If you like tricky code I can send you how to roll a cursor on an EXEC('')

Have a nice code :)|||There's no trick there, I've seen too much of that, and re-written most of it. I am glad I am out of that dirty business ;)|||That's it - sysadmins . . .
You all forgot the Mother ASseMbler (MASM) and how HARD is the planting for the SOFT to be neet and tidy ;)

All the best. Thanks for the company.

No comments:

Post a Comment