Declare in Pass-Through Queries

  • Thread starter Thread starter Lost
  • Start date Start date
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
 
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
 
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?
 
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.
 
Back
Top