Home Forums SQL Server 2005 Development Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. RE: Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

  • This isn't going to solve your problem, but it may get you in a position where it's easier to solve it yourself.

    My advice is to format your code so that it's easy to read. Below are some suggestions. You don't have to adopt them all, but please draw up some coding standards and stick to them. It'll help you to read and understand your code, it'll help your colleagues, and it'll make it far more likely that somebody will stop and help when you post it on a forum.

    * Remove all commented-out lines from your code before it goes into production

    * Use upper case for keywords and lower case for variables

    * Put comments in your code that explain what each section does

    * Use indents and line breaks so that the code is easy on the eye

    * Choose variable names wisely. For example, don't call a variable @start_Date if @StartDateSelectStatement describes it better

    * When posting code on this forum, use the code="sql" IFCode Shortcut so that it's displayed roughly as you'd see it in SSMS

    * Use a site such as poorsql.com to do an initial format of your code

    John