I have a stored proc which returns a result set with somewhere around 20 columns. I'm only interested in retrieving all rows of a specific column (username).
Here is what I have:
--create temp table
CREATE TABLE #USERNAMES(
username char(10)
)
--store results in a temp table
INSERT INTO #USERNAMES
exec dbo.getAccountInfo @subbed = 1
This won't work seeing as it wants to store the entire result set into the temp table, but the temp table has not defined all of the columns it needs. How can I modify the insert to only insert the username
column from the getAccountInfo
result set into the temp table #USERNAMES
?