© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
3 replies
Joakim

loop to insert

I'm trying to add into my qr_code table 100 new qr_codes.

I've got this code

declare @var int;
set @var = 0;
while @var < 100
begin
insert into qr_codes(store_id, action_type, value, is_redeemed, unique_key)
values (195, 2, 20, false, 78ZREZ87EZ12)
set @var =@var+1;
end
declare @var int;
set @var = 0;
while @var < 100
begin
insert into qr_codes(store_id, action_type, value, is_redeemed, unique_key)
values (195, 2, 20, false, 78ZREZ87EZ12)
set @var =@var+1;
end


But I get an error stating:
Failed to validate sql query: syntax error at or near "@"
Failed to validate sql query: syntax error at or near "@"


I struggle finding what is wrong with my loop. looking online at the syntax it's the same
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Bulk Insert RPC to return inserted values.
SupabaseSSupabase / help-and-questions
4y ago
Why doesn't an INSERT policy allow inserts?
SupabaseSSupabase / help-and-questions
4y ago
Insert method, can't insert data
SupabaseSSupabase / help-and-questions
4y ago
Failing to insert due to policy?
SupabaseSSupabase / help-and-questions
4y ago