Ernest
|
| Posted: 04/13/2005, 7:44 PM |
|
Using Codecharge 2.3
Sql Server 2000
Trying to combine the First + Middle + Last name fields. I've done this using code charge and MS Access using the string below and it works perfectly:
SQL = "SELECT [PersonnelId], [GroupID], [Troop], [Post], [AccessLevel], [FName]&' '&[LName] As Employee FROM [Personnel] WHERE [AllowLogin] = 1 AND [UserName]='" & Replace(Login, "'", "''") & "' AND [Pswd]='" & Replace(Password, "'", "''") & "'"
Using Sql Server 2000 i get error. If I select one of the name parts ie: (FName AS Employee), it works. Only gives the error when I try to combine two or more.
Error Type:
ADODB.Recordset (0x800A0E78)
Operation is not allowed when the object is closed.
/Gsp/Common.asp, line 1584
Is the syntax different for Sql as opposed to Access?
Thanks
Ernest
|
|
|
 |
Nicole
Posts: 586
|
| Posted: 04/14/2005, 2:43 AM |
|
Ernest,
Access and SQL Server have different syntax. Use plus (+) instead of ampersand (&) with SQL server:
SELECT FName + LName as EName from table_name
Also keep in mind that if fields are of different data type you need to convert them to the same data type using CAST() or CONVERT() functions.
_________________
Regards,
Nicole |
 |
 |
Ernest
|
| Posted: 04/14/2005, 8:09 AM |
|
THANKS !!!!
Solved the problem
|
|
|
 |
|