0

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...

4

1 に答える 1

0

IDENT_CURRENTを使用してこの値を予測することはできますが、それに対してアドバイスします。

変数を設定する場合は、次のことを試してください。

SET @filePrefix = 5 + @filePrefix

私はあなたの発言に少し混乱してTo speed things up, I don't want to do this on the server but rather do this on the database. いますこれはどういう意味ですか?

于 2012-07-06T15:07:30.027 に答える