Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 PLease help .. error of multiple identifier..

Author  Topic 

rwasim25
Starting Member

13 Posts

Posted - 2010-08-23 : 02:24:41
select convert(varchar,TBYVERS.CCIETEC)+'_'+TBYVERS.LNUMCON+'_'+convert(varchar,TBYVERS.NVRS) Policy_Reference,
'ACI' Business_Unit,
(select case
when TBYINCO.crolivn =2 and TBYINCO.dfin = '' then
(select TBYRELA.LNOMBSE+' '+TBYRELA.LPRNBSE+' '+'-'+' '+convert(varchar,TBYRELA.NREL)
from SIMC_TBYRELA TBYRELA where
TBYRELA.nrel = TBYINCO.NREL and
TBYINCO.CCIETEC = TBYVERS.CCIETEC and
TBYINCO.LNUMCON = TBYVERS.LNUMCON)
end from SIMM_TBYINCO TBYINCO) Insured_Name,
'Additional Insured' Insured_Type,
NULL Insured_Code
from SIMM_tbyvers TBYVERS


its giving error : Msg 512, Level 16, State 1, Line 2
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.


Can any one help why this so coz i have reference for all the tables.. The problem is in case statement.

Wasim..
Senior Test Engineer

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-08-23 : 04:45:00
[code]
select convert(varchar,TBYVERS.CCIETEC)+'_'+TBYVERS.LNUMCON+'_'+convert(varchar,TBYVERS.NVRS) Policy_Reference,
'ACI' Business_Unit,
x.Insured_Name,
'Additional Insured' Insured_Type,
NULL Insured_Code
from SIMM_tbyvers TBYVERS
INNER JOIN
(select case
when TBYINCO.crolivn =2 and TBYINCO.dfin = '' then TBYRELA.Val end AS Insured_Name,
TBYINCO.CCIETEC ,
TBYINCO.LNUMCON
from SIMM_TBYINCO TBYINCO
INNER JOIN (select LNOMBSE+' '+LPRNBSE+' '+'-'+' '+convert(varchar,NREL) AS Val,
nrel
from SIMC_TBYRELA) TBYRELA
ON TBYRELA.nrel = TBYINCO.NREL) x
ON x.CCIETEC = TBYVERS.CCIETEC and
x.LNUMCON = TBYVERS.LNUMCON
[/code]

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -