I want to simply execute a SQL query that would return the current id of the row that was added to a table, example:
insert into V_Post output inserted._ID values('Please return the id of THIS row :)')
That shall returns a number like 155
So the aim of my question is to store that number in some kind of local variable like XVALUE and then use this XVALUE in any other SQL query like:
insert into V_Posts values(1, XVALUE, null, GETDATE(), null, null, 1)
So i thougt of something like:
int XVALUE = insert into V_Post output inserted._ID values('Please return the id of THIS row :)')
insert into V_Posts values(1, XVALUE, null, GETDATE(), null, null, 1)
OR
insert into V_Posts values(1, insert into V_Post output inserted._ID values('Please return the id of THIS row :)'), null, GETDATE(), null, null, 1)
But both it didn't work :(
I hope i explained my question well and i really thank you in advance for your help.
EDIT
Please notice i have two tables: V_posts and V_post