code_junkie

Transact-Sql INTO Clause Syntax

Nov 14th, 2011
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. DECLARE @rowtemp table(TestRunID int, RunOrder int)
  2.  
  3. SELECT TestRunID, ROW_NUMBER() OVER (ORDER BY TestRuns.TestTime ASC)
  4. AS 'RunOrder' INTO @rowtemp FROM TestRuns WHERE RunID = @runID
  5.  
  6. DECLARE @rowtemp table(TestRunID int, RunOrder int)
  7.  
  8. INSERT INTO @rowtemp
  9. SELECT TestRunID, ROW_NUMBER() OVER (ORDER BY TestRuns.TestTime ASC)
  10. AS 'RunOrder' FROM TestRuns WHERE RunID = @runID
  11.  
  12. DECLARE @rowtemp table(TestRunID int, RunOrder int)
  13.  
  14. INSERT INTO @rowtemp
  15. SELECT
  16. TestRunID,
  17. ROW_NUMBER() OVER (ORDER BY TestRuns.TestTime ASC) AS 'RunOrder'
  18. FROM
  19. TestRuns
  20. WHERE
  21. RunID = @runID
Add Comment
Please, Sign In to add comment