I have this SQL statement:<br><br><br>drop table #tmp<br>go<br><br>select<br> substring(system_source_descr,1,15) 'Platform',<br> substring(system_id_type,1,15) 'ID_Type',<br> substring(person_source_descr,1,25) 'Person_Source', "ID_Linked" = <br><br>CASE<br> WHEN no_person_flg IS NULL THEN 'ID Not Linked' <br> WHEN no_person_flg = '' THEN 'ID Not Linked' <br> WHEN no_person_flg = 'Y' THen 'ID Not Linked'<br> WHEN no_person_flg = 'N' THEN 'ID Linked' ELSE 'ID Not Linked'<br>END <br><br>into #tmp <br><br> from cdr_master_xref<br> where system_id_status_flg not in ('I','X','Z')<br><br><br>Select Platform,<br> ID_Type,<br> ID_Linked,<br> Person_Source,<br> count(*) <br><br> from #tmp<br><br> group by Platform,<br> ID_Type,<br> ID_Linked,<br> Person_Source<br><br><br><br>and in VB Script I use the SQL statement in an ASP as follows:<br><br><br> SQLStmt.CommandText = "drop table #tmp" &_<br>" go" &_<br>" select" &_<br>" substring(system_source_descr,1,15) 'Platform'," &_<br>" substring(system_id_type,1,15) 'ID_Type'," &_<br>" substring(person_source_descr,1,25) 'Person_Source', " & chr(34) & "ID_Linked" & chr(34) & " =" &_<br>" CASE" &_<br>" WHEN no_person_flg IS NULL THEN 'ID Not Linked'" &_<br>" WHEN no_person_flg = '' THEN 'ID Not Linked'" &_<br>" WHEN no_person_flg = 'Y' THen 'ID Not Linked'" &_<br>" WHEN no_person_flg = 'N' THEN 'ID Linked' ELSE 'ID Not Linked'" &_<br>" END" &_ <br>" into #tmp" &_<br>" from cdr_master_xref" &_<br>" where system_id_status_flg not in ('I','X','Z')" &_<br>" Select Platform," &_<br>" ID_Type," &_<br>" ID_Linked," &_<br>" Person_Source," &_<br>" count(*)" &_<br>" from #tmp" &_<br>" group by Platform," &_<br>" ID_Type," &_<br>" ID_Linked," &_<br>" Person_Source"<br>SQLStmt.CommandType = 1<br>Set SQLStmt.ActiveConnection = OBJdbConnection <br>RS.Open SQLStmt<br><br><br>For some reason I get the error message: <br><br>Microsoft OLE DB Provider for ODBC Drivers error '80040e14' <br>[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near 'go'. <br><br>/newtotal.asp, line 97 <br><br><br>Does anyone have any ideas why this isn't working? Any advice is appreciated.<br><br>Thanks,<br>John