34,873
社区成员
发帖
与我相关
我的任务
分享CREATE PROCEDURE up_inquireTableExist
-- Add the parameters for the stored procedure here
@tableName char(6),
@s_exist bit output
AS
IF exists ( select 1 from sys.tables where name=@tableName
set @s_exit = 0
ELSE
set @s_exit = 1
GO
cm.Parameters.AddWithValue("@s_exist", 0);
cm.Parameters["@s_exist"].DbType = DbType.Bit;
cm.Parameters["@s_exist"].Direction = ParameterDirection.Output;
cm.ExecuteNonQuery();
if (int.Parse(cm.Parameters["@BudgetError"].Value.ToString()) == 1)
{
.......
}
CREATE PROCEDURE up_inquireTableExist
-- Add the parameters for the stored procedure here
@tableName char(6),
@s_exist bit output
AS
IF OBJECT_ID(@tableName,'U') IS NOT NULL --表名变量不用单引号
set @s_exist = 0 --缺少set
ELSE
set @s_exist = 1
GO SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE up_inquireTableExist
-- Add the parameters for the stored procedure here
@tableName char(6),
@s_exist bit output
AS
declare @sql varchar(1000)
SET @sql='
IF OBJECT_ID('''+@tableName+''',''U'') IS NOT NULL
SET @s_exit = 0
ELSE
SET @s_exit = 1'
print @sql
exec(@sql)
GO CREATE PROCEDURE up_inquireTableExist
-- Add the parameters for the stored procedure here
@tableName char(6),
@s_exist bit output
AS
IF exists ( select 1 from sys.tables where name=@tableName
set @s_exit = 0
ELSE
set @s_exit = 1
GO SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE up_inquireTableExist
-- Add the parameters for the stored procedure here
@tableName char(6),
@s_exist bit output
AS
IF OBJECT_ID('@tableName','U') IS NOT NULL
SET @s_exit = 0
ELSE
SET @s_exit = 1
GO SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE up_inquireTableExist
-- Add the parameters for the stored procedure here
@tableName char(6),
@s_exist bit output
AS
IF OBJECT_ID('@tableName','U') IS NOT NULL
Set @s_exist = 0
ELSE
Set @s_exist = 1
GO
IF OBJECT_ID('@tableName','U') IS NOT NULL
@s_exit = 0
ELSE @s_exit = 1 CREATE PROCEDURE up_inquireTableExist
-- Add the parameters for the stored procedure here
@tableName char(6),
@s_exist bit output
AS
IF OBJECT_ID('@tableName','U') IS NOT NULL
Set @s_exit = 0 -- 这里
ELSE
Set @s_exit = 1
GO