If I connect to an sql server manually using DB Tools Open Connec.VI the SQL query below (QUERY 1) works fine, but when I connect to the data base automatically using a connection string QUERY 1 does not work unless I modify as shown in QUERY 2 with all variables removed. Is there a limit on the number of characters allowed when using DB Tools Execute Query.VI? Does DB Tools Execute Query.VI not allow the use of variables in the query?
--QUERY 1
------------------------------------------------
declare @TestName as varchar(800)
declare @StartTime as datetime
declare @EndTime as datetime
set @TestName = 'SFR_LowerLeft'
set @StartTime = '2007-07-09 16:28:57'
set @EndTime = '2007-07-13 16:29:04'
select
t.name 'Test',
st.description 'Station',
mdp.name 'Test Step',
mdp.value 'Value',
mdp.hilim 'High Limit',
mdp.lolim 'Low Limit'
from
dbo.ffMeasurementDetailPass mdp
inner join
fftest t on t.id = mdp.testid
inner join
ffserialnumber s on s.unitid = t.unitid
inner join
ffstation st on st.id = t.stationid
where
mdp.name = @TestName and
testerstarttime >= @StartTime and
testerstarttime <= @EndTime and
st.description in ('L1-FOCTEST-01')
--QUERY 2
----------------------------------------------------------
select
t.name 'Test',
st.description 'Station',
mdp.name 'Test Step',
mdp.value 'Value',
mdp.hilim 'High Limit',
mdp.lolim 'Low Limit'
from
dbo.ffMeasurementDetailPass mdp
inner join
fftest t on t.id = mdp.testid
inner join
ffserialnumber s on s.unitid = t.unitid
inner join
ffstation st on st.id = t.stationid
where
mdp.name = 'SFR_LowerLeft' and
testerstarttime >= '2007-07-09 16:28:57' and
testerstarttime <= '2007-07-13 16:29:04' and
st.description in ('L1-FOCTEST-01')