There are times that we need to create SQL queries dynamically and pass values to parameters. You can always assign values with a syntax similar to “… WHERE ColumnName = ‘ + @Value + ‘ and …”. But the disadvantage of using the above syntax is, that you have to provide correct formatting according the data type of the column.
This can be prevented using this type of solution. (Assume you have to get a count of records which matches a certain condition which will be provide outside the query)