Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

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

Starting Member

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


print @maxnumber+@loop

set @loop = @loop + 1


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

Thank you

Flowing Fount of Yak Knowledge

2242 Posts

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

Go to Top of Page
  Previous Topic Topic Next 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.02 seconds. Powered By: Snitz Forums 2000