SQL Server IE joker belgilar

Ma'lumotlar bazamda products jadvali mavjud. Bu qatlamlari deb nomlangan ustunni o'z ichiga oladi. Ushbu ustunda 0102 shaklidagi ma'lumotlar mavjud bo'lib, bu erda 01 shkafi va 02 bu shkafdagi qatlamdir.

Ma'lumotlar bazasini shkaflar uchun ham (shunchaki qatlamlar uchun emas) so'rash kerak. Joker belgilarni qanday ishlatishim mumkin? Masalan - shkafi 01 , 02 va 03 kabi barcha mahsulotlarni so'rov qilish uchun?

Hozir menda bu bor, lekin u ishlamayapti:

SELECT Artikelnummer, Omschrijving, Legger, Voorraad 
FROM Artikels 
WHERE Legger LIKE 01* OR  Legger LIKE 02* OR  Legger LIKE 03*  
ORDER BY Artikelnummer

(Gollandiyalik ismlar uchun uzr so'raymiz)

1

1 javoblar

SQL Server T-SQL uses the % as the wildcard for "any characters (and _ for one character, any character - equivalent to ? in Windows/DOS), any numbre thereof" - and you also need to put your string literals into single quotes - so use:

SELECT Artikelnummer, Omschrijving, Legger, Voorraad 
FROM Artikels 
WHERE Legger LIKE '01%' OR  Legger LIKE '02%' OR  Legger LIKE '03%'
ORDER BY Artikelnummer
2
qo'shib qo'ydi