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 |
|
JonahMk2
Starting Member
21 Posts |
Posted - 2006-04-18 : 11:11:16
|
| I need to add a field to a query which i have created in SQL Server, i have done this in Access no problem and it works fine but when icopy the SQL code from Access to SQL it just falls over. This is my code in Access...SELECT AIMPDTA_CDADDR.CDCUST, AIMPDTA_CDADDR.CDADDC, AIMPDTA_CDADDR.CDNAME, AIMPDTA_CDADDR.CDADD1, AIMPDTA_CDADDR.CDADD2, AIMPDTA_CDADDR.CDADD3, [CDCUST] & [CDADDC] AS Expr1FROM AIMPDTA_CDADDR LEFT JOIN AIMPDTA_ASAREA ON AIMPDTA_CDADDR.CDNAME = AIMPDTA_ASAREA.ASNAMEWHERE (((AIMPDTA_CDADDR.CDADDC)<>" "));Any suggestions would be much appreciated.Thanks |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-04-18 : 11:43:54
|
| [CDCUST] + [CDADDC] as Expr1or convert(varchar(100),[CDCUST]) + convert(varchar(100),[CDADDC]) as Expr1depending on the datatype.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
druer
Constraint Violating Yak Guru
314 Posts |
Posted - 2006-04-18 : 16:00:26
|
| If you have the command in SQL Code already, why not just modify the command and hand type the extra field you are trying to bring back?Access and TSQL code are not completely compatible. Besides the "+" above, I think you'll also probably need to convert the WHERE clause to <> ' ' (single quotes instead of double.) |
 |
|
|
|
|
|