Problem using SQL 'except' command in Matlab Datbase Toolbox

1 view (last 30 days)
Here is the Follwing code I use after i sucessfully connect to a database:
if true
% codes
end
sqlquery=['select *'... %line 17
' FROM test.dbo.chem '...
' where substring(type,1,1) in ''B'''...
' and substring(num,1,6) in( ''800'', ''801'', ''802'',''803'')'
'except'...
'select *'...
'FROM test.dbo.chem'...
'where substring(type,1,1) in ''B'''...
'and substring(num,1,6) in ''800'''...
' order by heatno desc' ];...
curs = exec(conn,sqlquery)'...
curs = fetch(curs)'...
close(curs)
WHEN I RUN THE CODE INBETWEEN THE PARENTHESES BY ITSELF I CAN SUCESSFULLY QUERY THE DATABSE IN A SCRIPT FILE.
HOWEVER WHEN I RUN THE QUERY WITH THE SECTION OF CODE INBETWEEN THE @ SYMBOLS IN CONJUNCTION WITH EVERYTHIGN ELSE (USING AN EXCEPT COMMAND) I GET THE FOLLOWING ERROR:
Error using Collect_tischem_QUAL (line 17) Error using vertcat Dimensions of matrices being concatenated are not consistent.
when done in microsoft sql server management studio the sql part of the code works
when querying just the specific numbers in matlab the code works (using database toolbox)
when querying the specific numbers in matlab with the except command it does not work
any suggestions?
-Pat

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!