Setting parameters after obtaining their values in stored procedures

Posted by user1260028 on Stack Overflow See other posts from Stack Overflow or by user1260028
Published on 2012-07-06T14:51:59Z Indexed on 2012/07/06 15:15 UTC
Read the original article Hit count: 169

Filed under:
|
|

Right now I have an upload field while uploads files to the server. The prefix is saved so that it can later be obtained for retrieval. For this I need to attach the ID of the form to the prefix. I would like to be able to do this as such:

 @filePrefix = SCOPE_IDENTITY() + @filePrefix;

However I am not so sure this would work because the record has not been created yet. If anything I could call an update function which obtains the ID and then injects it into the row after it has been created. To speed things up, I don't want to do this on the server but rather do this on the database.

Regardless of what the approach is, I would still like to know if something like the above is possible (at least for future reference?) So if we replace that with

 @filePrefix = 5 + @filePrefix;

would that be possible? SQL doesn't seem to like the current syntax very much...

© Stack Overflow or respective owner

Related posts about sql

Related posts about query