CREATE PROCEDURE system_test(@out nvarchar(50)output)
as
if exists(select 1 from syscolumns where id=object_id('System_test') and name='System_run')
select @out='yes'
else
select @out='no'
说明:表'System_test'是我已经建好的,我就是想检查已经存在的表'System_test'它有没有列'System_run'?
as
if exists(select 1 from syscolumns where id=object_id('System_test') and name='System_run')
select @out='yes'
else
select @out='no'
说明:表'System_test'是我已经建好的,我就是想检查已经存在的表'System_test'它有没有列'System_run'?
as
begin
--syscolumns表是一个系统表,name列记录字段的名称,id列记录字段归属的表在sysobjects系统表中对应的id
if exists(select 1 from syscolumns where id=object_id('System_test') and name='System_run')
select @out='yes'
else
select @out='no'
end
go
(@out nvarchar(50)output)
as
if exists(select 1 from syscolumns where id=object_id('System_test') and name='System_run')
select @out='yes'
else
select @out='no'
name --字段是列名
id --關聯表的ID老大的語句沒問題, 很好啊