消息 102,级别 15,状态 1,过程 ProcedureName1,第 53 行?

therobinliu 2008-12-02 08:40:32
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Name1
-- Create date:
-- Description:
-- =============================================
CREATE PROCEDURE ProcedureName1
-- Add the parameters for the stored procedure here
@p1 int = 0
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

-- Insert statements for procedure here
INSERT dbo.tabTimeData( 区站号, 入库时间, 通信方式, 日期时间, 电源状态, 瞬时风速, 瞬时风向, 二分风速, 二分风向, 十分风速, 十分风向, 极大风速, 极大风向, 极大风速对应时间, 最大风速, 最大风向, 最大风速对应时间, 分钟雨量, 一小时雨量, 十分钟最大雨强, 最大雨强出现时间, 空气温度, 最高气温, 最高气温出现时间, 最低气温, 最低气温出现时间, 相对湿度, 最小湿度, 最小湿度出现时间, 本站气压, 最高气压, 最高气压出现时间, 最低气压, 最低气压出现时间)
select
cast(区站号 as char(8)),
cast(插入时间 as datetime),
'G',
cast(观测时间 as datetime),
cast(电池电压 as char(8)),
cast(瞬时风速 as int),
cast(瞬时风向 as int),
cast(二分钟平均风速 as int),
cast(二分钟平均风向 as int),
cast(十分钟平均风速 as int),
cast(十分钟平均风向 as int),
cast(极大风速 as int),
cast(极大风速的风向 as int),
cast(极大风速出现时间 as char(10)),
cast(最大风速 as int),
cast(最大风速的风向 as int),
cast(最大风速出现时间 as char(10)),
cast(小时每分钟雨量 as char(120)),
cast(小时雨量 as int),
NULL,
NULL,
cast(气温 as int),
cast(最高气温 as int),
cast(最高气温出现时间 as char(10)),
cast(最低气温 as int),
cast(最低气温出现时间 as char(10)),
cast(相对湿度 as int),
cast(最小相对湿度 as int),
cast(最小相对湿度出现时间 as char(10)),
cast(本站气压 as int),
cast(最高本站气压 as int),
cast(最高本站气压出现时间 as char(10)),
cast(最低本站气压 as int),
cast(最低本站气压出现时间 as char(10))
from openrowset('SQLOLEDB','FXQXJ';'sa';'sa',Meso_2008.dbo.JLHour_2008)
          where datediff(hh , dt , getdate()) = 0 order by dt desc
END
GO
------------------------
消息 102,级别 15,状态 1,过程 ProcedureName1,第 53 行
' ' 附近有语法错误。
...全文
1901 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
orientalsc 2009-11-01
  • 打赏
  • 举报
回复
去空格,厉害!
水族杰纶 2008-12-02
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 therobinliu 的回复:]
没看明白,你改哪儿了?
[/Quote]
去掉點空格~~
dawugui 2008-12-02
  • 打赏
  • 举报
回复
CREATE PROCEDURE ProcedureName1 
-- Add the parameters for the stored procedure here
@p1 int = 0
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

-- Insert statements for procedure here
INSERT dbo.tabTimeData( 区站号, 入库时间, 通信方式, 日期时间, 电源状态, 瞬时风速, 瞬时风向, 二分风速, 二分风向, 十分风速, 十分风向, 极大风速, 极大风向, 极大风速对应时间, 最大风速, 最大风向, 最大风速对应时间, 分钟雨量, 一小时雨量, 十分钟最大雨强, 最大雨强出现时间, 空气温度, 最高气温, 最高气温出现时间, 最低气温, 最低气温出现时间, 相对湿度, 最小湿度, 最小湿度出现时间, 本站气压, 最高气压, 最高气压出现时间, 最低气压, 最低气压出现时间)
select
cast(区站号 as char(8)),
cast(插入时间 as datetime),
'G',
cast(观测时间 as datetime),
cast(电池电压 as char(8)),
cast(瞬时风速 as int),
cast(瞬时风向 as int),
cast(二分钟平均风速 as int),
cast(二分钟平均风向 as int),
cast(十分钟平均风速 as int),
cast(十分钟平均风向 as int),
cast(极大风速 as int),
cast(极大风速的风向 as int),
cast(极大风速出现时间 as char(10)),
cast(最大风速 as int),
cast(最大风速的风向 as int),
cast(最大风速出现时间 as char(10)),
cast(小时每分钟雨量 as char(120)),
cast(小时雨量 as int),
NULL,
NULL,
cast(气温 as int),
cast(最高气温 as int),
cast(最高气温出现时间 as char(10)),
cast(最低气温 as int),
cast(最低气温出现时间 as char(10)),
cast(相对湿度 as int),
cast(最小相对湿度 as int),
cast(最小相对湿度出现时间 as char(10)),
cast(本站气压 as int),
cast(最高本站气压 as int),
cast(最高本站气压出现时间 as char(10)),
cast(最低本站气压 as int),
cast(最低本站气压出现时间 as char(10))
from openrowset('SQLOLEDB','FXQXJ';'sa';'sa',Meso_2008.dbo.JLHour_2008)
where datediff(hh , dt , getdate()) = 0 order by dt desc
END
GO
dawugui 2008-12-02
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 therobinliu 的回复:]
没看明白,你改哪儿了?
[/Quote]
也有可能是中文的空格,改为英文的空格就行了.
dawugui 2008-12-02
  • 打赏
  • 举报
回复
楼主把你代码中所有的tab改为''
therobinliu 2008-12-02
  • 打赏
  • 举报
回复
没看明白,你改哪儿了?
水族杰纶 2008-12-02
  • 打赏
  • 举报
回复
CREATE PROCEDURE ProcedureName1 
-- Add the parameters for the stored procedure here
@p1 int = 0
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

-- Insert statements for procedure here
INSERT dbo.tabTimeData( 区站号, 入库时间, 通信方式, 日期时间, 电源状态, 瞬时风速, 瞬时风向, 二分风速, 二分风向, 十分风速, 十分风向, 极大风速, 极大风向, 极大风速对应时间, 最大风速, 最大风向, 最大风速对应时间, 分钟雨量, 一小时雨量, 十分钟最大雨强, 最大雨强出现时间, 空气温度, 最高气温, 最高气温出现时间, 最低气温, 最低气温出现时间, 相对湿度, 最小湿度, 最小湿度出现时间, 本站气压, 最高气压, 最高气压出现时间, 最低气压, 最低气压出现时间)
select
cast(区站号 as char(8)),
cast(插入时间 as datetime),
'G',
cast(观测时间 as datetime),
cast(电池电压 as char(8)),
cast(瞬时风速 as int),
cast(瞬时风向 as int),
cast(二分钟平均风速 as int),
cast(二分钟平均风向 as int),
cast(十分钟平均风速 as int),
cast(十分钟平均风向 as int),
cast(极大风速 as int),
cast(极大风速的风向 as int),
cast(极大风速出现时间 as char(10)),
cast(最大风速 as int),
cast(最大风速的风向 as int),
cast(最大风速出现时间 as char(10)),
cast(小时每分钟雨量 as char(120)),
cast(小时雨量 as int),
NULL,
NULL,
cast(气温 as int),
cast(最高气温 as int),
cast(最高气温出现时间 as char(10)),
cast(最低气温 as int),
cast(最低气温出现时间 as char(10)),
cast(相对湿度 as int),
cast(最小相对湿度 as int),
cast(最小相对湿度出现时间 as char(10)),
cast(本站气压 as int),
cast(最高本站气压 as int),
cast(最高本站气压出现时间 as char(10)),
cast(最低本站气压 as int),
cast(最低本站气压出现时间 as char(10))
from openrowset('SQLOLEDB','FXQXJ';'sa';'sa',Meso_2008.dbo.JLHour_2008) where datediff(hh , dt , getdate()) = 0 order by dt desc
END
GO
therobinliu 2008-12-02
  • 打赏
  • 举报
回复
换了几个过程的名字还是不行

34,590

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧