guest2013-1
guest
- Joined
- Aug 22, 2003
- Messages
- 19,800
- Reaction score
- 13
Okay so I've been playing around with XML (as my data transporter) between servers and I'm using a bit of XQuery in my stored procedure to convert this back into a table. I then load the table into its corresponding table-type (predefined) and send it on it's way to it's corresponding controller (stored procedure that will process the data)
So instead of firing 1 stored procedure with x amount of parameters, 100 times, I load that data into the UDTT and only send that as a parameter to that stored procedure.
I do a simple
For updates/inserts etc. 100 records is less than 1 second, whereas calling the SP 100 times puts it to 10 records per second +-
I'm now in the stage where "What kind of logic am I going to want to apply to this in a stored procedure that will render my method useless and a normal parameter based stored procedure would be superior?"
So that's my question, can anyone poke any holes in this that "normal" T-SQL methods won't work. Push comes to shove you can still do cursors and normal IF logic... just wondering if there's anything special you guys can think of.
So instead of firing 1 stored procedure with x amount of parameters, 100 times, I load that data into the UDTT and only send that as a parameter to that stored procedure.
I do a simple
UPDATESET destination.Col1 = source.Col1
FROMdestination
INNER JOIN @UDTT source ON source.ID = destination.ID
WHERE action = 'Updated'
INSERT INTO(columns)
SELECT (columns) FROM @UDTT WHERE action = 'Inserted'
DELETE FROMWHERE Col1 IN (SELECT Col1 FROM @UDTT WHERE action = 'Deleted')
For updates/inserts etc. 100 records is less than 1 second, whereas calling the SP 100 times puts it to 10 records per second +-
I'm now in the stage where "What kind of logic am I going to want to apply to this in a stored procedure that will render my method useless and a normal parameter based stored procedure would be superior?"
So that's my question, can anyone poke any holes in this that "normal" T-SQL methods won't work. Push comes to shove you can still do cursors and normal IF logic... just wondering if there's anything special you guys can think of.