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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2000-08-22 : 21:53:42
|
Alison writes "The following SELECT is returning a SQL error in the UK.
SELECT SUBSTRING(ISD +' '+(SELECT (AREACODE + ' ') WHERE AREACODE IS NOT NULL) + TELECOMNUMBER, 1,20) FROM TELECOMMUNICATION WHERE TELECOMNUMBER IS NOT NULL
I have loaded their data into a new database here on server MSSQL65. We have compared versions of the database and they are the same namely:
Microsoft SQL Server 6.50 - 6.50.416 (Intel X86) Jan 23 1999 14:10:24 Copyright © 1988-1997 Microsoft Corporation
The error is :
Msg 512, Level 16, State 1 Subquery returned more than 1 value. This is illegal when the subquery follows =, !=, <, <= , >, >=, or when the subquery is used as an expression. Command has been aborted.
The solution is not as I first thought of changing the script to
SELECT SUBSTRING(ISD +' '+ Case when AREACODE is not null then AREACODE + ' ' Else '' End + TELECOMNUMBER, 1,20) FROM TELECOMMUNICATION WHERE TEL |
|
|
|
|
|