IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[sys_sql_errcheck]') AND type = 'P')
DROP PROCEDURE [dbo].[sys_sql_errcheck]
GO
-- 检查表名，字段名是否完整
create procedure [dbo].[sys_sql_errcheck](
@parseid int,
@haserr int output
)
as
begin
select @haserr =0
--存在名称错误的表
if (exists (select * from flatDSS where bizid<0 or bizid>999999))
begin
select @haserr=1
return
end
-- 应该是表不存在的表
if (exists (select * from flatDSS where tbname is null))
begin
select @haserr=1
return
end
--存在字段名称不存在的表，变量除外
if (exists(select * from flatFld where tbfld is null  and not fldexp like '@%'))
select @haserr=1

end