Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

Insert return value on update

$
0
0

Hello everyone, is there any how to, uppon an update, do and insert retrieving the value of it? I mean, by this query

insert myTable(date)
OUTPUT inserted.id values (GETUTCDATE())

it insert the value and return ID that I want, but when I try to pass it as a value on update, it doesn't work

update myOtherTable set indicator = (

insert myTable(date)
OUTPUT inserted.id values (GETUTCDATE())

)

where status = 3

it keeps saying that there is a syntax error near insert


Viewing all articles
Browse latest Browse all 8428

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>