March 24, 2017 at 11:39 am
BEGIN TRANSACTION
DELETE
FROM Inventory_BumpBarSettings
WHERE ItemNum like '%[^0-9]%' and LEN(ItemNum) = 12
DELETE
FROM Inventory_AdditionalInfo
WHERE ItemNum like '%[^0-9]%' and LEN(ItemNum) = 12
DELETE Inventory_TagAlongs
WHERE ItemNum like '%[^0-9]%' and LEN(ItemNum) = 12
DELETE Kit_Index
WHERE ItemNum like '%[^0-9]%' and LEN(ItemNum) = 12
DELETE Inventory_Bulk_Info
WHERE ItemNum like '%[^0-9]%' and LEN(ItemNum) = 12
DELETE Inventory_Vendors
WHERE ItemNum like '%[^0-9]%' and LEN(ItemNum) = 12
DELETE Inventory_Properties
WHERE ItemNum like '%[^0-9]%' and LEN(ItemNum) = 12
DELETE Inventory_SKUS
WHERE ItemNum like '%[^0-9]%' and LEN(ItemNum) = 12
DELETE Inventory_Coupon
WHERE ItemNum like '%[^0-9]%' and LEN(ItemNum) = 12
DELETE Inventory_Prices
WHERE ItemNum like '%[^0-9]%' and LEN(ItemNum) = 12
DELETE Inventory_Notes
WHERE ItemNum like '%[^0-9]%' and LEN(ItemNum) = 12
DELETE
FROM Inventory
WHERE ItemNum like '%[^0-9]%' and LEN(ItemNum) = 12
COMMIT
This does not seem to be working....the 'like '%[^0-9]%' is that correct synatx? I am not getting an error but when I run:
DELETE
FROM Inventory
WHERE LEN(ItemNum) = 12
Im still returning values, 12 in length that are all numbers.
Can someone nudge my brain this morning?
Thank you!
March 24, 2017 at 11:42 am
Would this work? (I know, test, but I am asking for further knowledge)
DELETE
FROM Inventory_BumpBarSettings
WHERE ISNUMERIC(ItemNum) = 12
UPDATE: Does not work, I am still returning data LEN(ItemNum) = 12 that are all digits.
UPDATE AGAIN: I found my issue, it was the ^ in front of the [0-9] code...
March 24, 2017 at 12:54 pm
chef423 - Friday, March 24, 2017 11:42 AMWould this work? (I know, test, but I am asking for further knowledge)
DELETE
FROM Inventory_BumpBarSettings
WHERE ISNUMERIC(ItemNum) = 12UPDATE: Does not work, I am still returning data LEN(ItemNum) = 12 that are all digits.
UPDATE AGAIN: I found my issue, it was the ^ in front of the [0-9] code...
IsNumeric returns a 1 or 0. And IsNumeric is not a good choice to find numbers. http://www.sqlservercentral.com/articles/ISNUMERIC()/71512/
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply