scottbak
-
Posts
3 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by scottbak
-
-
I want to be able to cycle through each value in the 2 fields and put the value in for: EXEC SearchAndReplace @find,@repl@find and @repl in that command line. So there are 100 records, so I want 100 different values for @find and @repl.I could not get your purpose, But the error is because of the statementsSET @find = (select sEmployeeID from tblPREE);SET @repl = (select sEmployeeIDf from tblPREE);as the query is returning more than 1 values which cannot be assigned to a variable. So use such query which will return only 1 value -
and use the values for each line in the below query as the @find and @repldeclare @find as varchar(12), @repl as varchar(12)SET @find = (select sEmployeeID from tblPREE);SET @repl = (select sEmployeeIDf from tblPREE);EXEC SearchAndReplace @find,@replGO the error I get when I run this is:Server: Msg 512, Level 16, State 1, Line 2Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.Server: Msg 512, Level 16, State 1, Line 3Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.Thanks for all your help,Scott
How to cycle through each field in a table...
in SQL
Posted