We help IT Professionals succeed at work.

sql: insert into table multiple items

I want to create a stored procedure where it does this:

1. a select statement picks up UserIP column from Comments (there could be 1, there could be 100)
2. take each of those UserIP's and insert into a table called NEWIP
Comment
Watch Question

Top Expert 2012
Commented:
INSERT NEWIP(UserIP)
SELECT UserIP
From Comments
Top Expert 2012

Commented:
A Stored Procedure is quite simple:
CREATE PROCEDURE usp_AddUserIPs

AS

SET NOCOUNT ON

INSERT  NEWIP (UserIP)
SELECT  UserIP
FROM	Comments

Open in new window