irozenberg (2/24/2011)
I agree, why Dynamic SQL AND Output?What about SCOPE_IDENTITY function?
Cheers
In the application, there wasn't just one key. There were a few, and there were plans to put in many more in the future. To cope with this, I wrote the dynamic sql so that the stored procedure could insert and fetch the values for any given key.
The naming convention I used for the tables was tbl_vert_<key>, where <key> would be replaced by the name of the KVP key.
Agreed the output clause could have been avoided with a call to scope_identity().
Ajit Ananthram
Blog - http://ajitananthram.wordpress.com