Command garbled when using sed

Hi everyone,

Can anyone help me in question below?
I want to cron a job to add partition every month but get the error sed: command garbled: s/YYYYMM/ .

> echo $YYYYMON_NEW
201304
> echo $YYYYMON_OLD
201208
> echo $YYYY_MM_NEW
2013-05

This is my base script:

ALTER TABLE STS.ADMIN ADD PARTITION ADMIN_TABLE_YYYYMM VALUES LESS THAN (TO_DATE('XXYYYY_MMXX-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS')) TABLESPACE ADMIN_TBSP;

Command that I use to replace the substitude the variable and the error that i get:

> sed "s/YYYYMM/$YYYYMON_NEW/g;s/XXYYYY-MMXX/$YYYY_MM_NEW/g" crt_partition_base.sql > $SQL_FILE
sed: command garbled: s/YYYYMM/

This is my os version:-

SunOS portal-db-1a 5.10 Generic_142909-17 sun4u sparc SUNW,Sun-Fire-V440

I can see the sed command has:
XXYYYY-MMXX

While the input text has:
XXYYYY_MMXX

That is going to screw up your logic. But it does not explain why the script exits with error.

Try doing just one of the s commands. Verify it's the first one that screws up.

echo the variables in a script immediately before the sed command. Verify what they are really set to.