Select Expression Operators

From: Gary K (GaryK_at_discussions.microsoft.com)
Date: 08/31/04


Date: Mon, 30 Aug 2004 22:49:06 -0700

Sorry for what must seem like a dumb question, but I was wondering why I keep
getting "<operator> not recognized" errors when I try to use the following
sql clause:

SELECT personid, IIF(LEN(ISNULL(middlename, '')) = 0, firstname + ' ' +
lastname, firstname + ' ' + middlename + ' ' + lastname) AS FullName FROM
mydatabase

Regardless of which operator I use (=, <, >, etc..) it is unrecognized when
the statement gets compiled. All I want to do is use the sql query to
concatenate the name strings to a full name without having extra spaces in
the middle when there is no middle name specified. I was able to use this
query with MS Access but I am having trouble porting it to SQL server. (Mind
you, in access I was able to use ISNULL by itself, not just checking for zero
length strings) Can someone please point out my error?



Relevant Pages

  • Re: Equivalent of Get Next Extended to retrieve only unique keys?
    ... The only real "extra" stuff is pertaining to SQL query optimization. ... Bill Bach wrote: ... Retaining the ability to filter on multiple>> items would probably ...
    (comp.databases.btrieve)
  • Re: Setting a Default Value
    ... the make the Sql call from within Application_Start in Global.asax. ... the query string value each time I needed to ... going to assign the default value through a database query. ... run the following SQL query: select * from table where x = 1 ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: 3vl 2vl and NULL
    ... "strings" specifically are so interesting to you. ... input that can be cast to a numeric type, ... but it is not expected that the DBMS is forcing you to do so. ... It seems you can't accommodate the SQL outcomes because it doesn't have a "shape" that you are comfortable with. ...
    (comp.databases.theory)
  • Re: Linq; expression parser?
    ... object based query at runtime and had to revert to stored strings. ... but if I had the need to write dynamic SQL inside the ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Performance Problem with Stored Procedure calls to Sql Server
    ... Look at this in SQL profiler. ... The strings contain XML. ... > Dim oRs As ADODB.Recordset ...
    (microsoft.public.data.oledb)