in sql management studio i can use following command:
use lohn;
go
declare @loc_zahl as int
set @loc_zahl = 0
if not exists (select * from sys.objects where object_id = object_id(N't_svdata') and type in (N'U'))
begin
raiserror('t_svdata existiert', 16, 1)
end
/* select * from t_svdata */
select @loc_zahl = count(svd_schl) from t_svdata
if @loc_zahl > 0
delete from t_svdata
/* drop table t_svdata */
go
select * from t_svdata
go
but when i use this in vc, the declare will not be accepted.
How to declare a unique variable?
Is there a precompiler or debugger to debug the mssql commands in a cobol program
here the cobol statement:
EXEC SQL
use lohn /* new command */
declare @loc_zahl int
set @loc_zahl = 0
IF EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N't_svdata') AND type in (N'U'))
BEGIN
RAISERROR('t_svdata existiert', 16 , 1)
END
else
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N't_svdata') AND type in (N'U'))
BEGIN
RAISERROR('t_svdata existiert', 16 , 1)
END
ELSE
print 'No problems here'
select @loc_zahl = count(svd_schl) from t_svdata
if @loc_zahl > 0
delete from t_svdata
/* drop table t_svdata */
END-EXEC
Thanks for help





