>When I using CONVERT function to convert nvarchar to numeric, I getting error message "Error converting data type nvarchar to numeric".
>I read help, and figured out that it is because there is charachters inside nvarchar variable.
>But is it possible to convert the same variables without errors, but zeros instead? :)
You can use
isnumeric() function to check if a string represents valid number before trying to convert it. See example below:
DECLARE @nstr nvarchar(100), @num numeric(10,2)
set @nstr = '12345.58'
SELECT @num = CASE WHEN ISNUMERIC(@nstr) = 1
THEN CONVERT(numeric, @nstr)
ELSE 0 END
--sb--