Showing posts with label thisselect. Show all posts
Showing posts with label thisselect. Show all posts

Friday, February 24, 2012

add columns from two queries

Hello all

im trying to add the the columns resulted from one query to other columns resulted from other query in a stored procedure

like this

select x1,x2,x3 from Table1
select x4,x5 from table

i want to put it like this

x1 x2 x3 x4 x5

:)

i really need this helpp

thank youuuYou need to use a join. From what you've posted I can't tell which fields relate the records in one table to the records in another. But it would look something like this:


Select Table1.x1,Table1.x2,Table1.x3, Table.X4, Table.X5
FROM Table1 inner join Table on (Table1.JoinField=Table.OtherJoinField)

Sunday, February 12, 2012

Ad Hoc Distributed Query Against MS Access

Hello,
I have been looking for an example of how to do an ad hoc distributed query to an MS Access database. I've tried this;

select * from OpenRowSet('Microsoft.Jet.OLEDB.4.0',
'\\Server1\Data\Corporate\CPSDaily\Tools\Test.mdb' ;'admin';'',Names)

I recieve an OLEDB provider error when I try it this way. The version of Access is 2003. The database 'Test.mdb' is on a network share, and the table is called 'Names'. The share is located on the machine that hosts SQL Server 2000.

Is there a setting in sql server that can be set to allow/disallow ad hoc distributed queries?

What am I missing?

Thank you for your help!

cdun2

Are you doing something in SSIS, or shall I move this to the Transact-SQL forum?|||I was attempting to do this within an Execute SQL Task of an SSIS package.|||Why don't you create an OLE connection manager object that points to the Access database and then in the Execute SQL Task you reference that OLE connection manager and then simply use a "select * from table" query?|||

Ultimately, I was attempting to incorporate the use of CASE in the query. Anyway, I found a better way to do was I was trying to do, but I have another problem with a Precedence Constraint.

Thank you for your response, I'll post again later.