In SQL Server 2008, how do I check if a varchar parameter can be converted to datatype money? <p>I've got a stored procedure I use to insert data from a csv. The data itself is a mix of types, some test, some dates, and some money fields. I need to guarantee that this data gets saved, even if it's formatted wrong, so, I'm saving them all to varchars. Later, once the data's been validated and checked off on, it will be moved to another table with proper datatypes. </p> <p>When I do the insert into the first table, I'd like to do a check that sets a flag (bit column) on the row if it needs attention. For instance, if what should be a money number has letters in it, I need to flag that row and add the column name in an extra errormsg field I've got. I can then use that flag to find and highlight for the users in the interface the fields they need to edit. </p> <p>The date parameters seem to be easy, I can just use <code>IF ISDATE(@mydate) = '0'</code> to test if that parameter could be converted from varchar to datetime. But, I can't seem to find an ISMONEY(), or anything that's remotely equivalent. </p> <p>Does anyone know what to call to test if the contents of a varchar can legitimately be converted to money?</p> <p><strong>EDIT:</strong> I haven't tested it yet, but what do you think of a function like this?:</p> <pre><code>CREATE FUNCTION CheckIsMoney ( @chkCol varchar(512) ) RETURNS bit AS BEGIN -- Declare the return variable here DECLARE @retVal bit SET @chkCol = REPLACE(@chkCol, '$', ''); SET @chkCol = REPLACE(@chkCol, ',', ''); IF (ISNUMERIC(@chkCOl + 'e0') = '1') SET @retVal = '1' ELSE SET @retVal = '0' RETURN @retVal END GO </code></pre> <p><strong>Update</strong></p> <p>Just finished testing the above code, and it works!</p>