adam (er******@wp.pl) writes:
I try to substitute "for" loop by this excample:
declare @i int
while (@i<10)
begin
insert into dbname.dbo.table_name values @i
@i=@i+1
end
but in line @i=@i+1 ocured an error. Why ?
You need to say SET or SELECT in front. I prefer SELECT, as you can assign
more that one variable in one bang:
SELECT @a = 1, @b = @c + d, @t = NULL
--
Erland Sommarskog, SQL Server MVP,
es****@sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp