Change it like shown below. HOWEVER, the string you are constructing looks like you are trying to build a query string for use in dynamic SQL. Two bad things about that:a) dynamic sql is vulnerable to SQL injection, so avoid it if you can.b) the sql string looks like you are using a cursor. Almost always, a cursor is a bad thing to use - it can slow down performance SUBSTANTIALLY.If you post your requirements, people on the forum may be able to suggest better ways of writing the query. Take a look at this page for help in posting table DDL and data:http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxSET @Comm=' DECLARE curSum CURSOR FOR SELECT ISNULL(SUM(' + @Field + '),0) Total FROM Table WHERE Date>=' + CONVERT(varchar(32),@Date1 , 126) + ' AND Date<=' + CONVERT(varchar(32),@Date2 , 126)