SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 help query
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

kabon
Starting Member

Indonesia
48 Posts

Posted - 09/04/2013 :  04:26:28  Show Profile  Reply with Quote
I have query like this :

declare @maxnumber int,@generate int,@loop int

set @maxnumber = 0

set @generate = 15000 --jumlah yang input

set @loop = 1



select @maxnumber = MAX(RECID) from a where COMPANY_BOOK = 'ID0010002' and left(RECID,1) = 7 --cabang nya



while @loop <= @generate

begin

print @maxnumber+@loop

set @loop = @loop + 1

end

How to make this query which is that print into select into.

Thank you

bandi
Flowing Fount of Yak Knowledge

India
2218 Posts

Posted - 09/04/2013 :  05:49:07  Show Profile  Reply with Quote
SELECT @maxnumber = @maxnumber+@loop


--
Chandu
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000