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)
 reserved word 'select' in data

Author  Topic 

smithmggc
Starting Member

3 Posts

Posted - 2010-11-23 : 17:59:28
I have a table with a varchar(40) field. One of the records contains the value 'Select Benefit...'
I can query the table w/o any problem.
select *
from carriers

if I query a view that uses this table the query fails with the error;

Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

I know how to deal with reserved words as table and field names using '[' and ']', but I don't see any way to resolve this.
Anyone??

Thanks!

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-11-23 : 18:05:37
Post the view code.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-11-23 : 18:06:34
By the way, your error is unrelated to the data or object (I'm unclear which it is) using a reserved word.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2010-11-23 : 20:01:11
quote:
Originally posted by tkizer

Post the view code.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog



Which means post the DDL...from SSMS, right click, script objects,

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

smithmggc
Starting Member

3 Posts

Posted - 2010-11-24 : 09:56:04
OK, this view is ~990 lines, I counted over 100 left joins. This is not my database. The field only appears to be used in the select statement, didn't see it in any of the joins.
and this is how it appears in the select statement.

SECCARR.Name AS Sec_Policy_Carrier_Name,

I was going to create a simple view to see if I could not recreate the error.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-11-24 : 09:58:24
this doesnt have any problem. You need to at least post the portion of code which you feel the error is happening.

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

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-11-24 : 10:47:47
quote:
Originally posted by smithmggc

OK, this view is ~990 lines, I counted over 100 left joins.



Wow! This may be one place where denormalizing would be a good idea.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2010-11-24 : 11:42:33
Does it ever come home?

Maybe they should go back to 6.5



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

smithmggc
Starting Member

3 Posts

Posted - 2010-11-29 : 11:12:25
indeed the error does appear to be caused by some other problem in the database. It actually being caused by a subquery that returns more than one more than record.

It was misleading for me because if I didn't select the field that contained the 'Select ...' data in it I didn't get that error.

Thanks for all of the responses!
Go to Top of Page
   

- Advertisement -