Incorrect Results using Convert Query

  •  

     

    SELECT SUM(CONVERT(integer, CAST(tablename.columnnameA AS varchar))) AS [Total Units], tablename.columnnameB, tablename.columnnameC FROM table INNER JOIN tableC ON tablename.columnname = tablename.columnname WHERE     (DATEPART(mm, table.creationDate) = '5') AND (DATEPART(yyyy, table.creationDate) = '2004') AND (table.columnname = '3') AND (tablename.columnname = '1925') GROUP BY tablenameA.columnname, tbalenameB.colname

     

    when I run the above in IIS I get an incorrect Total Units value. it is one less than what is shown when I execute the query right on SQLServer2K.

     

    I hope I've provided enuff info to get a response as I'm new to this.

  • It may be obvious, but check that your IIS page is connecting to the same server and database that you are running the query on. Check the contents of the connectionname.connectionstring property in the page on IIS.

    Regards

    Peter

  • I added a the connection string to my page and sure enough got the correct results. It's these obvious little mistakes that keep me spinning my wheels for hours sometimes.

     

    Thanks!!

    Rich

  • Sometimes it just needs a fresh pair of eyes, to look at the problem from a different angle.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply