I have a TADOQuery
component which is connected to an SQL Server database using TADOConnection
.
Now, when I add below SQL to the component, and call ExecSql its raising proper exception, because there is a typo in the 'Create' word.
exec ('creat1e table myTable
(
col1 TPT_Dt not null ,
col2 TPT_FLOAT not null
)');
But the same statement, if I add it to another statement, then the TADOQuery component ignores this exception. E.g. :
select * from SomeOtherTable where id = 10
exec ('creat1e table myTable
(
col1 DtDataType not null ,
col2 FLOATDataType not null
)');
Could you please tell me why Delphi ignores the exception in the second case.
my issue is not with the select statement. even if i add an if condition then also same issue ;
for example
if not exists (select * from dbo.sysobjects where id = object_id('TABLE1278') and type='U')
begin
exec ('crea11te table table1278
(
col1 TPT_Dt
)');
end
delphi simply ignores the typo.
Thanks in advance.
Basil
if not exists...
without a select first? if yes then I cannot reproduce. if you do you a select before, then I think the issue is with SQLexec
. if I omit the exec and usecrea11te
statement then an error is raised. Ive tested it withADOCinnection.Execute
witheoExecuteNoRecords
(default) and this should not even try and rerun a recordset like TADOQuery. interesting question anyway. – kobikSET NOCOUNT ON
) did not helped for me. – kobik