Mojo
2012-06-18 19:34:59 UTC
Hi All
Apols if this a noddy question, but I just can't fathom it!!! :0)
I use a long SQL script (DDL ??) to drop, create and populate my db each
time (rather than a backup) and initially the DB needs key values inserted
into it.
At the mo, I try to remember to scroll up and down the script (quite long
now) to populate it with the required values for the given time, but I much
rather do what I used to do in MySQL, which was to put varaibles at the very
top of my script so that the values entered at the top then reflect further
down, eg
Line 1 : SET @MyYear= 2012;
...
...
...
Line 304: .INSERT ... .... ....., @MyYear, ... ....
I've tried this, but it appears as though my GO statements stop it from
working. I'm probably wrong, but this seems to suggest that I need to set
the var about 1 or 2 rows above the actual INSERT, which defeats my purpose.
Is there a way round this?
Thanks
Apols if this a noddy question, but I just can't fathom it!!! :0)
I use a long SQL script (DDL ??) to drop, create and populate my db each
time (rather than a backup) and initially the DB needs key values inserted
into it.
At the mo, I try to remember to scroll up and down the script (quite long
now) to populate it with the required values for the given time, but I much
rather do what I used to do in MySQL, which was to put varaibles at the very
top of my script so that the values entered at the top then reflect further
down, eg
Line 1 : SET @MyYear= 2012;
...
...
...
Line 304: .INSERT ... .... ....., @MyYear, ... ....
I've tried this, but it appears as though my GO statements stop it from
working. I'm probably wrong, but this seems to suggest that I need to set
the var about 1 or 2 rows above the actual INSERT, which defeats my purpose.
Is there a way round this?
Thanks