I have a SQL Server database. I want to count number of rows where the id starts from 1112 .
(id is string and its format in data base is nchar(7))
I have 20 rows that start from 1112 like 1112000, 1112001, 1112002,….
But when I write this query returns 0!.
SELECT COUNT(*) AS num
FROM table
WHERE (id LIKE '1112*')
You should use
%instead of*.LIKE (Transact-SQL)