code_junkie

What's the syntax for variables in an MSSQL stored procedure?

Nov 11th, 2011
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. select * from mytable where id > 8
  2.  
  3. declare @myvar int
  4. myvar = 8
  5.  
  6. DECLARE @MyVariable INT
  7. SET @MyVariable = 8
  8.  
  9. declare @myvar int
  10.  
  11. Set @myvar = 8
  12.  
  13. select * from mytable where id > @myvar
  14.  
  15. declare @myvar int
  16.  
  17. select @myvar = 8
  18.  
  19. SET @one = 1
  20. SET @two = 2
  21.  
  22. SELECT @one = 1, @two = 2
Add Comment
Please, Sign In to add comment