Declare in Pass-Through Queries

L

Lost

Hi,

I am having trouble declaring date value in pass through sql query.

Below is what i have currently -

Declare @BegDate as datetime
Declare @EndDate as datetime
select @BegDate = '01-jan-2005'
select @EndDate = '30-sep-2005'

When i run this in Access - i get an error saying 'Returns no value'
but when i run it in Query Analyzer it returns the values i want.

Any ideas?

Thanks
 
D

Duane Hookom

SQL QA will return multiple recordsets. The pass-through will attempt to
return only the results of the first SQL statement.

When I run your SQL in QA, I get "The command(s) completed successfully". I
only returned the values when I added:

SELECT @BegDate, @EndDate
 
L

Lost

Declare @BegDate as datetime
Declare @EndDate as datetime
select @BegDate = '01-jan-2005'
select @EndDate = '30-sep-2005'

select CompletionDate betwee @BegDate and @End date.

When i run this as a pass through query - i get a msg that no records
were returned but in QA there are records that are returned. Any ideas
why?
 
R

Rick Brandt

Lost said:
Declare @BegDate as datetime
Declare @EndDate as datetime
select @BegDate = '01-jan-2005'
select @EndDate = '30-sep-2005'

select CompletionDate betwee @BegDate and @End date.

When i run this as a pass through query - i get a msg that no records
were returned but in QA there are records that are returned. Any
ideas why?

AFAIK a PT query cannot execute everything that QA can. It can only pass a
single statement.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top