sqlclr - SQL CLR - retrieving data / updating results -


As part of my business logic, I need to get 2000+ rows from a SQL table; those lines are somewhat complex, Run through procedural, business logic (yes, it should be procedural, and so far all the technical techniques that have been researched do not deduct it for efficiency). Then I have to update the database, and return the result.

Using SQLDataReader - Data exits from SQL, and in my argument - which just works fine.

Repeats on the logic data, and makes the necessary changes.

To save changes now - I do not really want to send the result to an update statement by filling the parameter. If I have found a result in SQL, then I will be in the floating table with the base table, and make all the updates in the same TSQL update statement. My "table" is in SQL CLR, and the base table is ending on the SQL side.

I have read the techniques about XML serializing the results, and have completely moved it to a varchar variable - but I am using SQL Server 2008 R2.

I've looked at the UDT, and table value parameters - but you can not use them to transfer data between SQL CLR and SQL.

If SQL SLR takes the value of using complex business logic - is there a best practice to send data there? I have not found any examples yet, which talks directly on this issue or talks.

To update all your columns at one time, databases in different records in the same call You are right to use XML if you can use a sample of the query below. If the objeecid id ('sample 1') is not a tap drop table sample 1 sample 1 (id int identity (1,1), first name varchar (100), to create table. Last name varchar (100)) declared @xmldata xml set @ xmlatt = n 'lieutenant; Sample & gt; & Lt; Data & gt; & Lt; Firstname & gt; J & lt; / Firstname & gt; & Lt; Lastname & gt; Kenny & lt; / Lastname & gt; & Lt; / Data & gt; & Lt; Data & gt; & Lt; Firstname & gt; Lid & lt; / Firstname & gt; & Lt; Lastname & gt; Kurtis & lt; / Lastname & gt; & Lt; / Data & gt; & Lt; Data & gt; & Lt; Firstname & gt; Lee & lt; / Firstname & gt; & Lt; Lastname & gt; Cortez & lt; / Lastname & gt; & Lt; / Data & gt; & Lt; / Sample & gt; 'Declare @ xml_hndl int exec sp_xml_prepared document @xml_hndl OUTPUT, @xmldata insert sample1 (first name, last name) above with OpenXML (@xml_handle,' / sample / data ', 2) (first name with varchar (100) Select firstname, up.lastname Lastname varchar (100)) Up EXEC sp_xml_removed document @xml_hndl Select * 1 from sample 1

You want to update, insert, delete with any operation , This code will work from SQL Server 2005 to Danli

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -