[Solved] Creating stored procedure getting Incorrect syntax near the keyword ‘Declare’


The @search should be an input parameter of the stored proc, (no Declare required), and you need an As between the signature block for the stored proc and the body of the proc.

Create PROCEDURE [dbo].[usp_cloud_ClientAllSearch]
 @Search NVARCHAR(30)
As

   SELECT client_Name, client_Surname, client_CompanyName, 
        clientContact_TelephoneNo, clientContact_MobileNo, 
        clientAddress_PostalCode
   FROM cloud_Client c
       Join dbo.cloud_ClientAddresses a
          ON a.client_ID = c.client_ID
       LEFT JOIN cloud_ClientContact cc
          ON cc.client_ID = c.client_ID
   WHERE c.client_Name LIKE @Search + '%' or 
         c.client_Surname LIKE @Search + '%' or 
        cc.clientContact_MobileNo LIKE @Search + '%' or 
         a.clientAddress_PostalCode LIKE @Search + '%'

solved Creating stored procedure getting Incorrect syntax near the keyword ‘Declare’