views:

144

answers:

2

Hi, this is a rather pathetic problem:

In Visual Basic 2008 Express with SQL Server Compact 3.5 and the Usual DataSet / TableAdapters, My Query is too long:

Changing the names, it is a query like this:

SELECT Table1.*, Table3.* 
FROM Table1 
    INNER JOIN Table2 
        ON Table1.ID = Table2.T1ID 
    INNER JOIN Table3 
        ON Table2.T3ID = Table3.PK

Problem is, Table1 and Table3 have around 10 and 5 columns each, with rather descriptive names, and The Table adapter is insistent on writing all the columns out and therefore hacks off my command. (It won't take * 's, it always says it can't find the column Table1.* )

Is there a way around this?

+1  A: 

If you add an alias for the tables, will the table adapter take it?

SELECT t1.*, t3.* 
FROM Table1 t1
     INNER JOIN Table2 t2
         ON t1.ID = t2.T1ID
     INNER JOIN Table3
         ON t2.T3ID = t3.PK
ZippyV
I think it would still write out the Columns (t1.Column1, t1.Column2, ... etc ...)
wsd
Yes, but maybe it makes the query short enough.
ZippyV
good thinking, I'm upvoting even if this doesn't work, because it might for similar issues, and because there's a good idea behind it
wsd
since theres no further development on this question, and on the whole the answer is the best submitted, I'll accept it. FYI, I'm moving to MySQL.
wsd
A: 

Put the query in a stored procedure and then just call it. (It's also cleaner, more efficient, and helps encapsulate the logic within the database instead of your application just doing anything it likes)

Jason Williams
Except stored procedures are not supported on SQL Server compact.
ZippyV
Exactly, so this is a No-No.
wsd