Guest User

spTwo

a guest
Feb 18th, 2016
78
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. USE tempdb
  2. GO
  3.  
  4. CREATE PROC spOne
  5.     @showResults BIT = 1
  6. AS
  7. BEGIN
  8.  
  9.     SET NOCOUNT ON
  10.  
  11.     SELECT *
  12.     INTO ##mytemptable
  13.     FROM sys.objects
  14.  
  15.     IF @showResults = 1
  16.     BEGIN
  17.         SELECT *
  18.         FROM ##mytemptable
  19.     END
  20.  
  21. END
  22. GO
  23.  
  24. CREATE PROC spTwo
  25. AS
  26. BEGIN
  27.  
  28.     SET NOCOUNT ON
  29.  
  30.     EXEC spOne @showResults = 0;
  31.  
  32.     SELECT *
  33.     FROM ##mytemptable
  34.     WHERE CAST(object_id AS VARCHAR(10)) LIKE '0%'
  35.  
  36. END
  37. GO
  38.  
  39. --The data set I'm trying to add
  40. EXEC spTwo
RAW Paste Data