Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Help

Author  Topic 

numerator
Starting Member

1 Post

Posted - 2007-11-16 : 05:02:46
I want to write a sp uasing open query
and havin statment like

select * from openquery
(M1,'exec skt '''+@fromdate+''','''+@todate+'')
want to execute a sp through open query but its showing error that

"Server: Msg 170, Level 15, State 1, Procedure Shops, Line 23
Line 23: Incorrect syntax near '+'."
Can u pls tell me the solution?

kishore_pen
Starting Member

49 Posts

Posted - 2007-11-16 : 06:18:11
use convert function at @fromdate & @todate variables.
Go to Top of Page

anonymous1
Posting Yak Master

185 Posts

Posted - 2007-11-16 : 09:59:36
have you tried using OPENDATASOURCE? something like this...

EXEC OPENDATASOURCE('SQLOLEDB' ,'Server=local;Database=Northwind;Integrated Security=SSPI').Northwind.dbo.skt @fromdate, @todate
Go to Top of Page
   

- Advertisement -