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

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 strored procedure code error(s?)

Author  Topic 

johnmce@oceanfree.net
Starting Member

2 Posts

Posted - 2005-11-05 : 07:42:36
Hi Guys,
A newbie here who is trying to create a stored procedure which will add extra records to a table so I can practice tuning it. Get the following error with the code below.
gives me the following:

error 170: line 4:incorrect syntax near '=' . Must declare the variable '@high value'

Any ideas? thanks John


CREATE PROC addtoorder
@mycount int
AS
declare @highvalue = mycount+1000
while @mycount<@highvalue
begin
insert into orders (orderID, CustomerID, orderdate) values (@mycount, 'VINET', getdate())
insert into [order details] values (@mycount, 11, 14, 2, 0)
set @mycount =@mycount+1
end
return
go

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-11-05 : 07:52:26
Instead of

declare @highvalue = mycount+1000

Try this

declare @highvalue int
set @highvalue = mycount+1000



Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

johnmce@oceanfree.net
Starting Member

2 Posts

Posted - 2005-11-05 : 09:30:48
Thank you problem solved. Much appreciated.
Go to Top of Page
   

- Advertisement -