You need a table variable and it can be this simple.
declare @ID table (ID int)
insert into MyTable2(ID)
output inserted.ID into @ID
values (1)
More Related Contents:
- Max Nbr of Months W/ No Activity in Past 12 Months
- SQL server query to output the data shown below
- Will ANSI JOIN vs. non-ANSI JOIN queries perform differently?
- How do I generate a random number for each row in a T-SQL select?
- Combine multiple results in a subquery into a single comma-separated value
- How do you view ALL text from an ntext or nvarchar(max) in SSMS?
- Floor a date in SQL server
- How to drop a table if it exists?
- Create a view with ORDER BY clause
- What does ‘COLLATE SQL_Latin1_General_CP1_CI_AS’ do?
- INSERT INTO vs SELECT INTO
- Possible to store value of one select column and use it for the next one?
- How FOR XML PATH(”) works when concatenating rows
- Scheduled run of stored procedure on SQL server
- SQL Server ORDER BY date and nulls last
- SQL Server variable columns name?
- What is the Oracle equivalent of SQL Server’s IsNull() function?
- How can I get the sum of multiple datetime values?
- Use of Begin / End Blocks and the Go keyword in SQL Server?
- How do you determine what SQL Tables have an identity column programmatically
- Ampersand (&) operator in a SQL Server WHERE Clause
- Avg of float inconsistency
- how to write number to word function in sql server [closed]
- SQL Server error “Implicit conversion of because the collation of the value is unresolved due to a collation conflict.”
- SQL SERVER – Understanding how MIN(text) works
- Pivot multiple columns based on one column in SQL Server
- @@ERROR and/or TRY – CATCH
- INSERT INTO @TABLE EXEC @query with SQL Server 2000
- How to calculate difference in hours (decimal) between two dates in SQL Server?
- Cannot delete rows from a temporal history table