-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Perhaps this? Not too sure of the UPDATE statement. Read the Books on
Line (BOL) for more info on T-SQL syntax for UPDATE w/ SELECT.
CREATE PROCEDURE usp_UpdateNRecords
@nRecords INTEGER,
@update_value VARCHAR -- change data type to whatever you need.
AS
-- Set up a dynamic SQL string that will be EXECuted.
DECLARE @strSQL VARCHAR(500)
SET @strSQL =
'UPDATE table_name
SET column_name = ' + @update_value + '
SELECT TOP ' + @nRecords + ' *
FROM table_name
WHERE -- set up <criteria> as needed
ORDER BY column_name'
EXEC (@strSQL)
The table_name refers to the same table in both the Update & Select
statements.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBQTzxqoechKqOuFEgEQI5rgCghcuQFBeDp12Lmj+VoBALzWeU0FwAoP3G
JN3i5d/xv+bgvWk4xcq+fVW5
=UFFV
-----END PGP SIGNATURE-----