You should try printing your command when they yield errors. If you issued this instead of executing it:

    PRINT @cmd;

You would see that this:

    WHERE ValueDate BETWEEN ' + CONVERT(VARCHAR,@b,121) + ' AND ' + CONVERT(VARCHAR,@E,121)

Yields this:

    WHERE ValueDate BETWEEN 2012-07-01 AND 2014-01-25

Which, since those look to SQL Server like three integers with a couple of subtraction operators, becomes:

    WHERE ValueDate BETWEEN 2004 AND 1988

Which isn't even a valid BETWEEN operation, even if it *could* translate those to dates.

What you *should* be doing is passing these as proper parameters, e.g.

    SET @cmd = 'DELETE FROM dbo.DateTable -- always use SCHEMA prefix
     WHERE ValueDate BETWEEN @b AND @e;';

    EXEC sp_executesql @cmd, N'@b DATE, @e DATE', @b, @e;

If any of these columns are `DATETIME`, not `DATE`, you really should not be using `BETWEEN` at all. Instead:

    WHERE ValueDate >= @b AND ValueDate < DATEADD(DAY, 1, @e);

Please read:

- http://sqlblog.com/blogs/aaron_bertrand/archive/2009/10/09/bad-habits-to-kick-declaring-varchar-without-length.aspx
- http://sqlblog.com/blogs/aaron_bertrand/archive/2009/10/11/bad-habits-to-kick-avoiding-the-schema-prefix.aspx
- http://sqlblog.com/blogs/aaron_bertrand/archive/2011/10/19/what-do-between-and-the-devil-have-in-common.aspx