存储过程从参数sql server 2005获取变量名 [英] store procedure get variable name from parameter sql server 2005

查看:66
本文介绍了存储过程从参数sql server 2005获取变量名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我正在执行以下过程,但出现此错误:

hi to all

i am executing following procedure but give this error :

Msg 102, Level 15, State 1, Procedure getdata, Line 12
Incorrect syntax near ''@DataFeed''.





ALTER procedure [dbo].[getdata]
(

@DataFeed varchar(20)='my.xls'


)
as

SELECT *
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=E:\backup\'@DataFeed'', 'select * from [Sheet1$] where area is not null')

推荐答案

其中的区域不为空')
where area is not null')


FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=E:\backup\' + @DataFeed + '', 'select * from [Sheet1

select *中选择* br/>


其中的区域不为空')
where area is not null')


尝试此操作,您需要使用+连接字符串.
希望对您有所帮助.


Try this, you need to concatenate the strings using +.
Hope it helps.


这篇关于存储过程从参数sql server 2005获取变量名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆