How To Delete Records From A Column Which Belong To A Different Data Type?
So I inserted few records in a table manually (without using Stored procedure) and rows were fine under a column 'COLMN'. Then I tried to automate it by using dynamic-SQL in stored
Solution 1:
The easiest way to find numeric strings is probably comparing upper and lower case of the column name, if it's numeric both will be the same:
SELECT*FROM PROD_CE_WORK_SPACE.NPVAZ_CVM_CHECK_TEST_CASE_5
WHERELOWER(COLMN) =UPPER(COLMN) (CASESPECIFIC)
OR COLMN ISNULLIf this returns the correct rows simply change to a DELETE.
Solution 2:
Why don't you just try to locate the wrong rows in a WHERE condition?
COLMN must be a string, because a good content is 'STRETCH_DOLLAR_ADJUSTED'.
From the table cutout you show above, you start with:
SELECT*FROM NPVAZ_CVM_CHECK_TEST_CASE_5
WHERE COLMN ISNULLORLEFT(COLMN,1) IN (
'-'
, '+'
, '0'
, '1'
, '2'
, '3'
, '4'
, '5'
, '6'
, '7'
, '8'
, '9'
);
Refine the WHERE condition until you get the rows you intend, and then use that WHERE condition in a DELETE statement.
Or am I getting something wrong?
Marco the Sane .
Post a Comment for "How To Delete Records From A Column Which Belong To A Different Data Type?"