June 20th, 2013, 08:04 AM
Loop Shema Script
(short background) My company are currently building a small application alongside our main work, we will be using a Postgresql DB.
What I am actually trying to do is a SQL script that loop creates a whole bunch of schemas and names them accordingly.
Something along the lines of:
Create Schema ljschema1
name = +1
If you catch my drift
so the next one would be called ljschema2 etc. etc.
Thanks in advance, and don't hesitate to tell me if what I am asking is stupid.
June 20th, 2013, 08:45 AM
Something like this:
For more details please see the manual:
counter := 1;
stmt := 'create schema ljschema' || counter::text;
counter := counter + 1;
exit when counter > 5;
Comments on this post
Last edited by shammat; June 20th, 2013 at 08:48 AM.
I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags.
Tips on how to ask better questions:
June 21st, 2013, 04:48 AM
Thankyou very much