Select will allow more than one records to to assigned to variable:
SELECT @var = singleColumn
FROM tab
Set either allow one record, or generate an error while the original value of variable remains unchanged:
SET @var =
( SELECT singleColumn
FROM tab
)
http://sqlblogcasts.com/blogs/tonyrogerson/archive/2006/05/18/449.aspx
No comments:
Post a Comment