declare @XueShu int
set @XueShu=0
while @XueShu<=10
begin
set @XueShu=@XueShu+1
.
.
--其他sql代码部分
.end
--
在未使用while @XueShu<=10循环时,
--其他sql代码部分 是可以独立运行的,
但是使用之后,出现
消息 102,级别 15,状态 1,第 13 行
'end' 附近有语法错误。
消息 102,级别 15,状态 1,第 176 行
'end' 附近有语法错误。
---
会不会是while循环内不能有太多的begin-end?
请教!
set @XueShu=0
while @XueShu<=10
begin
set @XueShu=@XueShu+1
.
.
--其他sql代码部分
.end
--
在未使用while @XueShu<=10循环时,
--其他sql代码部分 是可以独立运行的,
但是使用之后,出现
消息 102,级别 15,状态 1,第 13 行
'end' 附近有语法错误。
消息 102,级别 15,状态 1,第 176 行
'end' 附近有语法错误。
---
会不会是while循环内不能有太多的begin-end?
请教!
解决方案 »
- 新人求助!
- SQL注入
- 提示必须声明@table 求助F姐姐 tony哥 乌龟哥 77哥 老黎哥
- 关于2005与2000索引的问题
- 对自己实在无语,简单的一个union all问题
- 请教几个初学问题。。。每问5分,先到先得。。。
- 高难度问题:SQL2000函数中动态SQL的实现, 请邹老大出手相救
- 如何为空表添加记录!两个关于用vc建立sql server2000数据库的问题.(
- 一个表内有最高分,现在得分等字段,当现在得分高于最高分时,更新最高分字段内容,当<=最高分时,最高分字段内容不变。用SQL Server如何实现?请指教!!!
- 问题简单但没有人回答!
- 大家看看
- 怎样将某个字段中的字母转换为大写
declare @XueShu int
set @XueShu=0
while @XueShu<=10
begin
set @XueShu=@XueShu+1
if not exists (select * from sysobjects where xtype='U' and name='xueall')
begin
create table xueall(id int IDENTITY (1,1) PRIMARY KEY,BorP char(1))
end--<<这个位置出错
go
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GOif not exists (select * from sysobjects where xtype='U' and name='xue')
begin
create table xue(id int IDENTITY (1,1) PRIMARY KEY,P1 tinyint,P2 tinyint,P3 tinyint ,B1 tinyint ,B2 tinyint ,B3 tinyint ,BorP char(1))
end
if not exists (select * from sysobjects where xtype='U' and name='g1')
begin
CREATE TABLE g1 (id int IDENTITY (1,1) PRIMARY KEY, pat int )
end
...省略
...
insert into xueall(BorP) select BorP from xue where BorP='P' or BorP='B'
TRUNCATE TABLE g1
TRUNCATE TABLE g2
TRUNCATE TABLE xue
end--<<这个位置出错
if not exists (select * from sysobjects where xtype='U' and name='xueall')
begin
create table xueall(id int IDENTITY (1,1) PRIMARY KEY,BorP char(1))
go
end
试试
begin
create table xueall(id int IDENTITY (1,1) PRIMARY KEY,BorP char(1))--<<这个位置出错
go
end--<<这个位置出错
---
消息 102,级别 15,状态 1,第 12 行
')' 附近有语法错误。
消息 102,级别 15,状态 1,第 1 行
'end' 附近有语法错误。
修改之后出现的问题。
--
把go 都去掉
之后已经解决问题。
--
为什么要去掉go呢?