sql server - SQL Error 512 while making sql job -
i getting error sql below:
subquery returned more 1 value. not permitted when subquery follows =, !=, <, <= , >, >= or when subquery used expression.
does know how can solve it?
use character declare @guild_codex varchar(25) declare @character_name0 varchar(40) declare @user_no0 varchar (25), @id varchar (25) declare @user_no varchar (25), @group_id varchar (25), @amount varchar (25) declare @free_amount varchar(25), @2mx_leader varchar(3), @2mx_member varchar (3) set @2mx_leader = 700 set @2mx_member = 500 set @id = (select id [pc-id].[cash].[dbo].[user_cash] free_amount 0) set @user_no = (select user_no [pc-id].[cash].[dbo].[user_cash] free_amount 0) set @group_id = (select group_id [pc-id].[cash].[dbo].[user_cash] free_amount 0) set @amount = (select amount [pc-id].[cash].[dbo].[user_cash] free_amount 0) set @free_amount = (select free_amount [pc-id].[cash].[dbo].[user_cash] free_amount 0) set @guild_codex = (select guild_code siege_info siege_tag like'y') set @character_name0 = (select character_name guild_char_info guild_code @guild_codex , peerage_code 0) set @user_no0 = (select user_no user_character character_name @character_name0) use cash update user_cash set amount=amount+@2mx_leader user_no = @user_no0
multiple issues sql
to assign values multiple variables, selecting same table, same clause, making multiple trips db, while can done in 1 single call, this:
select @id = id, @user_no = user_no, @group_id = group_id, @amount = amount, @free_amount = free_amount [pc-id].[cash].[dbo].[user_cash] free_amount 0
you using like, return multiple rows of data, stated in error message. try using = if can. alternately, try executing select statements responsible populating variables see if more 1 row of data returned.
raj
Comments
Post a Comment