How to set variables in DTS
Posted in 2005
Topics: Stored Procedures & SPL, Connectivity: ODBC / JDBC / .NET, Server Administration, Data Types & Schema Design
I have an informix database from which i need to fill a table in SQL
every half hour. Within SQL I have the following code where hsplit the
local SQL table is:
declare @mytime as datetime
declare @hourtime as varchar(2)
declare @minutetime as varchar(2)
declare @variable as int
set @mytime = dateadd(mi, -30, getdate())
set @hourtime = datepart (hh,@mytime)
set @minutetime = datepart(mi, @mytime)
set @variable = @hourtime + case
when (@minutetime / 30 < 1)
then '00'
else '30'
end
select * from hsplit
where starttime =@variable
When i use the ODBC connection via Openlink to the Oracle dbase i get
syntax errors.....can anyone help me to resolve this?
This is Microsoft SQL Server syntax, and you also mention Oracle. Are you using
the linked server feature to do something like read from Oracle and insert into
Informix? If so, shouldn't you be using the OPENQUERY function in your select
statement? Please give us more detail and the exact error message.
--
Regards,
Doug Lawry
www.douglawry.webhop.org
<jeroen@wallenburg.demon.nl> wrote in message
news:1122903366.615217.45190@g14g2000cwa.googlegroups.com...
>I have an informix database from which i need to fill a table in SQL
> every half hour. Within SQL I have the following code where hsplit the
> local SQL table is:
>
> declare @mytime as datetime
> declare @hourtime as varchar(2)
> declare @minutetime as varchar(2)
> declare @variable as int
> set @mytime = dateadd(mi, -30, getdate())
> set @hourtime = datepart (hh,@mytime)
>
> set @minutetime = datepart(mi, @mytime)
> set @variable = @hourtime + case
> when (@minutetime / 30 < 1)
> then '00'
> else '30'
> end
>
> select * from hsplit
> where starttime =@variable>
> When i use the ODBC connection via Openlink to the Oracle dbase i get
> syntax errors.....can anyone help me to resolve this?