title: How to use SQL Variables inside a query ( SQL Server )?
body: <p>I have written the following SQL Stored Procedure, and it keeps giving me the error at 
  <code>@pid = SELECT MAX(...</code> The whole procedure is:</p>
  
  <pre><code>Alter PROCEDURE insert_partyco
  @pname varchar(200)
  AS
  BEGIN
      DECLARE @pid varchar(200);
  
      @pid = SELECT MAX(party_id)+1 FROM PARTY;
      INSERT INTO party(party_id, name) VALUES(@pid, @pname)
      SELECT SCOPE_IDENTITY() as PARTY_ID
  END
  GO
  </code></pre>
  
  <p>Can anyone please tell me what I'm doing wrong here?</p>