A: 

In SQL SERVER

       DECLARE @Count INT
        SET @COUNT = SELECT COUNT(*) FROM SomeTable
        insert into newTable (fieldName) values (@Count)

     OR


      INSERT INTO newTable (fieldName)
      SELECT COUNT(*) FROM SomeTable
ydobonmai
A: 

Not sure which database, so I'll write Sybasish.

declare @count int
select @int = count (1) from  ... the rest of your query
insert another_table values (@count, 'other_field')
DVK
+1  A: 

You should use an INSERT-SELECT. That is an INSERT that uses all the rows returned from the SELECT as the values to insert. So try something like this (SQL Server example code):

DECLARE @TableToCount  table (fieldName varchar(5))
INSERT INTO @TableToCount VALUES ('A')
INSERT INTO @TableToCount VALUES ('B')
INSERT INTO @TableToCount VALUES ('C')

DECLARE @TableToStore  table (fieldName int)

INSERT INTO @TableToStore
    (fieldName)
    SELECT 
        COUNT(fieldName)
        FROM @TableToCount

SELECT * FROM @TableToStore

OUTPUT:

fieldName
-----------
3

(1 row(s) affected)
KM
+2  A: 

If you are using SQL Server, then why not use the @@ROWCOUNT

Ardman