var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: looping insert query
hai all...need you're help...^^
how to do looping for INSERT query in postgresql 8.4...?? let's say I want to do INSERT to table for 100 times...
before I used query below in SQLserver 2000 and it can works...but in postgresql 8.4 it can't...>.<
@count as integer
set @count = 1
while @count <= 100
insert into <tablename> values('...','...','...')
set @count = @count + 1
OS I used = Windows XP
Well that's nice tsql you have there. You won't be able to run it on Postgres though. You can create procedures in a variety of languages on Postgres including c, java, perl, python, ruby, php and r. But the most common is probably pl/pgsql.
PostgreSQL: Documentation: Manuals: PostgreSQL 8.4: PL/pgSQL - SQL Procedural Language
But generally on Postgres, you wouldn't use a procedure for this in the first place.
INSERT INTO foo (myId, myDate, myStuff)
SELECT i, '2009-01-01'::date + i, 'sample data'
FROM generate_series(1,100) i;
waw...it works...tq very much artacus...^^
Originally Posted by
generate_series is a very handy function.
"Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
"I have my standards. They may be low, but I have them!" - Bette Middler
"It's a book about a Spanish guy named Manual. You should read it." - Dilbert