SQL 简单语句 不知道错误 在哪儿 请指教
CREATE PROCEDURE DetectRalationError @tablename varchar(40),@id varchar(30),@pid varchar(20) AS
declare @sql varchar(400),
@where varchar(100),
@temp varchar(20)
set @sql= "SELECT * FROM " +@tablename+ "WHERE "
if @tablename= "Sys_物资分类代码表 "
begin
end
!!!!end附近有语法错误
------解决方案--------------------being end之间必须有东西。
------解决方案--------------------being end之间必须有东西。
------解决方案--------------------being end之间必须有东西。
------解决方案--------------------把 "改为 '
CREATE PROCEDURE DetectRalationError @tablename varchar(40),@id varchar(30),@pid varchar(20) AS
declare @sql varchar(400),
@where varchar(100),
@temp varchar(20)
set @sql= 'SELECT * FROM ' +@tablename+ 'WHERE '
if @tablename= 'Sys_物资分类代码表 '
begin
select @sql
end
------解决方案--------------------CREATE PROCEDURE DetectRalationError @tablename varchar(40),@id varchar(30),@pid varchar(20) AS
declare @sql varchar(400),
@where varchar(100),
@temp varchar(20)
set @sql= "SELECT * FROM " +@tablename+ "WHERE "
if @tablename= "Sys_物资分类代码表 "
begin
Print @tablename
end
------解决方案--------------------CREATE PROCEDURE DetectRalationError @tablename varchar(40),@id varchar(30),@pid varchar(20) AS
declare @sql varchar(400),
@where varchar(100),
@temp varchar(20)
set @sql= "SELECT * FROM " +@tablename+ "WHERE "
if @tablename= "Sys_物资分类代码表 "
begin
end
CREATE PROCEDURE DetectRalationError @tablename varchar(40),@id varchar(30),@pid varchar(20) AS
declare @sql varchar(400),
@where varchar(100),
@temp varchar(20)
set @sql= 'SELECT * FROM ' +@tablename+ 'WHERE '
if @tablename= 'Sys_物资分类代码表 '
begin
print @sql
end
------解决方案--------------------CREATE PROCEDURE DetectRalationError @tablename varchar(40),@id varchar(30),@pid varchar(20) AS
declare @sql varchar(400),
@where varchar(100),
@temp varchar(20)
set @sql= "SELECT * FROM " +@tablename+ " WHERE " ----空格
if @tablename= "Sys_物资分类代码表 "
begin
exec(@sql+ '表名 ')
end
------解决方案--------------------CREATE PROCEDURE DetectRalationError @tablename varchar(40),@id varchar(30),@pid varchar(20) AS
写错..订正一下:
declare @sql varchar(400),
@where varchar(100),