title: How can i create(add) a new row in an existing table AND insert a row in another table?
body: <pre><code>CREATE PROCEDURE  _InsertAttbts
      @Attribute VARCHAR(100)
  
  AS 
  
      IF  NOT EXISTS (SELECT * FROM dbo.Attributes WHERE Attribute = @Attribute)
  
      INSERT INTO dbo.Attributes(Attribute)
                  VALUES(@Attribute)
  
      IF  NOT EXISTS (SELECT * FROM DBO.Products WHERE Pname =@Attribute)
  
          ALTER TABLE PRODUCTS
          ADD @Attribute varchar(100)
  </code></pre>
  
  <p>Here <code>Products</code> is my master table and <code>Attributes</code> is its child table. My task is if the user tries to insert a new row it checks whether the row is existing, if not it wants to add new row in the product table and same time it should be inserted the same value in the attribute field in the attributes table...</p>
  
  <p>I am using SP in SQL Server 2012.</p>
  
  <p>Plz Help!</p>
  
  <p>Thanks....</p>