Reputation: 15
ALTER Procedure [dbo].[SELECT_STATUS_OF_MAILREPORT]
(@ID int, @Name varchar(15))
As
Begin
Select ID, NAME, CONTACT, EMAIL, SUBJECT, DISCRIPTION
From dbo.ProInfo
Where ID = 45 and Name Like '%@Name%'
End
Upvotes: 0
Views: 30
Reputation: 4900
No... Your where statement is using a literal to compare to name... You need to change it to this.
ALTER Procedure [dbo].[SELECT_STATUS_OF_MAILREPORT](@ID int,@Name varchar(15))
As
Begin
Select ID,NAME, CONTACT, EMAIL, SUBJECT, DISCRIPTION
From dbo.ProInfo
WHERE ID=45 and Name Like '%' + @Name + '%'
End
Note: for this to work, @Name can not be null...
Upvotes: 3