Advertisement
piotrek77

XL ciąg dokumentów korekty

Jun 6th, 2012
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.61 KB | None | 0 0
  1. declare @tab1 table (typ int, numer int)
  2. declare @typMain int
  3. declare @numerMain int
  4. set @typMain = 2042
  5. set @numerMain = 4659667
  6.  
  7. declare @typ int
  8. declare @numer int
  9.  
  10.  
  11. select @typ = TrN_ZwrTyp, @numer = TrN_ZwrNumer from cdn.Tranag WHERE TrN_GIDTyp = @typMain and TrN_GIDNumer = @numerMain
  12. INSERT INTO @tab1 VALUES(@typMain, @numerMain)
  13.  
  14. WHile (NOT ((@typ =@typMain) AND (@numer=@numerMain)) ) AND (@typ <> 0)
  15. begin
  16. insert INTO @tab1 VALUES(@typ, @numer)
  17.  
  18. Select @typ = TrN_ZwrTyp, @numer = TrN_ZwrNumer from cdn.TraNag Where TrN_GIDTyp = @typ AND TrN_GIDNumer = @numer
  19. End
  20.  
  21.  
  22.  
  23.  
  24. select * from @tab1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement