Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
YAQ on BIZ and DA tiers
Message
From
30/08/2009 16:10:12
 
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01419401
Message ID:
01421769
Views:
54
Kevin,

No, I did not know that about SQL 2008. And, given the fact that I will probably be re-evaluating some of my past (read "old") best practices, I will probably have to look into some of this newer stuff. Better late than never I guess. <g>

~~Bonnie



>Well, I'm not sure what you mean in the case of MS SQL. I send data (one row of data at a time), to what I call a PUT Stored Proc and depending on the value of the PK parameter that gets passed, the SP knows to do an INSERT (if the PK is < = 0) or an UPDATE for any other PK value. OK, I make an assumption there that an invalid PK won't get passed. So, I'm not sure what you mean by a sequence of INSERT followed by UPDATE.
>
>
>Bonnie, you may be interested to know (and perhaps you already know this) that with SQL 2008, you can pass an ADO.NET DataTable as a parameter to a 2008 stored proc. Basically, there's a new Table type. As I mentioned to Christof, 2008 also has a MERGE capability where you can do INSERT and UPDATE operations in a single line of code.
>
>Also, at one point I thought this was going to come up, but it didn't, still I'll mention it anyway....starting in 2005, in an UPDATE or INSERT statement, you can OUTPUT data from the INSERTED/DELETED tables (that were previously available only in triggers). So one can insert or update, and output columns from INSERTED/DELETED (which might include new identity PKs generated) without needing another SELECT statement or another call back to the database.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform