Created
April 17, 2020 05:38
-
-
Save Konctantin/d48dd1ef7cfb276447134a39eec6aa8e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select count(*) | |
-- delete | |
from kcmod.dbo.THP_SpisHead where | |
Create_dt < '20150101' or ( | |
Create_dt < '20200101' and ( | |
ISNUMERIC([name]) = 1 -- число как имя списка | |
or Kol < 5 -- количетво вагонов меньше 5 | |
or len([name]) < 5 -- имя списка короче 5 символов | |
or [name] like '%ааа%' | |
or [name] like '%ббб%' | |
or [name] like '%ввв%' | |
or [name] like '%ггг%' | |
or [name] like '%ддд%' | |
or [name] like '%еее%' | |
or [name] like '%жжж%' | |
or [name] like '%ззз%' | |
or [name] like '%эээ%' | |
or [name] like '%иии%' | |
or [name] like '%ыыы%' | |
or [name] like '%ккк%' | |
or [name] like '%ллл%' | |
or [name] like '%ммм%' | |
or [name] like '%ннн%' | |
or [name] like '%ооо%' | |
or [name] like '%ппп%' | |
or [name] like '%ррр%' | |
or [name] like '%ссс%' | |
or [name] like '%ттт%' | |
or [name] like '%ууу%' | |
or [name] like '%фф%' | |
or [name] like '%хх%' | |
or [name] like '%цц%' | |
or [name] like '%шш%' | |
or [name] like '%чч%' | |
or [name] like '%щщ%' | |
or [name] like '%ююю%' | |
or [name] like '%яяя%' | |
or [name] like '%ььь%' | |
or [name] like '%ъъъ%' | |
or [name] like '%ывы%' | |
or [name] like '%вава%' | |
or [name] like '%+++%' | |
or [name] like '%---%' | |
or [name] like '%***%' | |
or [name] like '%!!!!%' | |
or [name] like '%????%' | |
or [name] like '%1111%' | |
or [name] like '%2222%' | |
or [name] like '%3333%' | |
or [name] like '%4444%' | |
or [name] like '%5555%' | |
or [name] like '%6666%' | |
or [name] like '%7777%' | |
or [name] like '%8888%' | |
or [name] like '%9999%' | |
or [name] like '%0000%' | |
) | |
) | |
/* | |
-- удаление "бесхозных" записей | |
delete v from kcmod.dbo.THP_SpisVag v | |
left join kcmod.dbo.THP_SpisHead h on h.IdSpis = v.IdSpis | |
where h.IdSpis is null | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment